linux - -b 参数在 csh 中有什么作用?

标签 linux shell csh tcsh

我正在查看具有以下 shebang 行的 tcsh 脚本:

#!/bin/tcsh -fb

# then executes some commands

-b 有什么作用?

来自手册页:

-b Forces a ''break'' from option processing, causing any further shell arguments to be treated as non-option arguments. The remaining arguments will not be inter- preted as shell options. This may be used to pass options to a shell script with- out confusion or possible subterfuge. The shell will not run a set-user ID script without this option.

但是我真的不明白这是什么意思...

一个例子会很棒。

谢谢。

最佳答案

例如,您有一个名为 --help 的脚本,并且您想使用 tcsh 执行它:

tcsh --help

这显然行不通。 -b 强制 tcsh 停止寻找参数并将命令行的其余部分视为文件名或脚本参数。所以,要运行上面奇怪命名的脚本,你可以这样做

tcsh -b --help

关于linux - -b 参数在 csh 中有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10207736/

相关文章:

mysql - 配置单元使用 mysql 元存储

php - 如何列出目录内容

linux - 如何在 N 行内 grep 多个字符串

command - csh 脚本 : check if command exists

regex - 使用 sed 将不可打印的代码替换为他们的 vi 编辑器代码

python - 克服 Python 2.3 中的 os.system() 限制

C 拆分 CMD 参数

c - fread 用垃圾填充缓冲区

arrays - 通过 SSH 执行存储在关联数组中的 bash 命令,存储结果

linux - 如何获取特定端口的进程 ID 和进程名称