Search code examples
linuxshellcshtcsh

What does the -b argument do in csh?


I am looking at a tcsh script that has the following shebang line:

#!/bin/tcsh -fb

# then executes some commands

What does the -b do?

From the man page:

-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.

But I don't really understand what it means...

An example would be great.

Thanks.


Solution

  • Say, for example, you have a script that is named --help and you want to execute it using tcsh:

    tcsh --help
    

    This will obviously not work. The -b forces tcsh to stop looking for arguments and treat the rest of the command line as file names or arguments to scripts. So, to run the above weirdly named script, you could do

    tcsh -b --help