exec
The command it runs, su, replaces the shell without creating a new process.
sudo -s /bin/sh -c
The substitute user runs the specified shell, /bin/sh and executes the following command.
exec "$0" "$@"
Run command $0
, the name of the script, (your first variable, i.e., /opt/nsq/bin/nsqd
)
"$@"
with all the arguments, using the appropriate quoting
--
Delimits the option list. Everything following, even if they begin with a hypen, are considered to be operands. For example, sort -- -r
reads from the file named -r
instead of trying to use '-r' as an option.