bash 无法运行 tar 命令 - 无效选项 - '?'

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36937560/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 14:35:01  来源:igfitidea点击:

Unable to run tar command - invalid option -- '?'

bashunixscriptingcommandtar

提问by Angus

I've run into a problem while running a tar script. I am getting an invalid option, as shown in the screenshots, that is stopping the script running. I don't get why however as the command worked outwith the script. Can anyone help me?

我在运行 tar 脚本时遇到了问题。我得到一个无效的选项,如屏幕截图所示,停止脚本运行。然而,我不明白为什么,因为命令与脚本一起工作。谁能帮我?

The script:

剧本:

The script

剧本

The error:

错误:

The error

错误

回答by Angus

Thanks to Paul R I have an answer. No idea how to mark his comment as the answer though so here it is:

感谢 Paul RI 有一个答案。不知道如何将他的评论标记为答案,所以这里是:

Some older versions of tar don't like the -at the start of the commands - try tar cvpfz ....– Paul R 5 mins ago

一些旧版本的 tar 不喜欢-命令开头的 - 尝试tar cvpfz ....- Paul R 5 分钟前

回答by Yeop

In my case, i tried chmod 777 'FILE_NAME'for unlock the file.

就我而言,我尝试chmod 777 'FILE_NAME'解锁文件。

Then installing, it works well!

然后安装,效果很好!