I have this shell command:
kill `cat -- $PIDFILE`
What the double -- does here? Why not use just
kill `cat $PIDFILE`
I have this shell command:
kill `cat -- $PIDFILE`
What the double -- does here? Why not use just
kill `cat $PIDFILE`
The
--
tellscat
not to try to parse what comes after it as command line options.As an example, think of what would happen in the two cases if the variable
$PIDFILE
was defined asPIDFILE="--version"
. On my machine, they give the following results:POSIX.1-2017
POSIX also specifies it at: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02
See also: https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean-also-known-as-bare-double-dash