我可以在 Linux 中混合文本和二进制吗?
我想简化 Linux 系统上应用程序的安装,使其成为一键式安装。为此,我希望将 bash 脚本与压缩的 tar 结合起来。
所以我有 install.sh
和 some_app.tar.gz
文件。
然后我有一个 Ant 任务来执行此操作:
cat install.sh some_app.tar.gz > some_app.exe
简而言之,文件读取自身、解压缩 tarball 并提取文件并更改权限。
当我单独运行 install.sh
时,它工作正常,但是一旦我运行 some_app.exe
,它就会失败并出现以下错误:
/some_app.exe: line 4: Binary file (standard input) matches + 1: arithmetic syntax error
所以我想知道文本是否可以与二进制组合?
I want to simplify installation of the app on Linux system, to make it sort of one click. To do that I hope to combine bash script with compressed tar.
So I have install.sh
and some_app.tar.gz
files.
Then I have an Ant task that does this:
cat install.sh some_app.tar.gz > some_app.exe
In short, file reads itself, decompresses tarball and extracts files and changes permissions.
When I run install.sh
separately it works fine, but once I run some_app.exe
it fails with the following error:
/some_app.exe: line 4: Binary file (standard input) matches + 1: arithmetic syntax error
So I wonder if text can be combined with binary?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
完全可行。
示例: http://www.stuartwells.net/slides/selfextract.htm
Perfectly feasible.
Example: http://www.stuartwells.net/slides/selfextract.htm
您要查找的是 Bash 自解压 Tar 文件。
What you are looking for are Bash Self-Extracting Tar files.
已经完成了:P ... http://megastep.org/makeself/
Already done :P ... http://megastep.org/makeself/