What was the meaning of a special character on the shebang line?

Tags:

Answer: 1

23 hours ago

I saw a script like below,

#! /bin/zsh -
del=10
rm -f /mnt/md0/capture/DCN/*(ND.Om[1,$del])

What was purpose of adding - on a shebang line?

Answer: 2

21 hours ago

A - or -- signals the end of options and disables further option processing. Which means that bash will not accept any of its option. Any arguments after the -- are treated as filenames and arguments.

An argument of - is equivalent to --. This is done to improve script security. Some user may perform setuid based script root spoofing. To avoid interpreter spoofing you need to add -- to #!/bin/bash. This is rare but possible attack.nixCraft

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9