gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 09:51:48 26 4
gpt4 key购买 nike

我正在查看具有以下 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com