I can’t seem to use the Bash “-c” option with arguments after the “-c” option string

You need to use single quotes to prevent interpolation happening in your calling shell.

$ bash -c 'echo arg 0: $0, arg 1: $1' arg1 arg2
arg 0: arg1, arg 1: arg2

Or escape the variables in your double-quoted string. Which to use might depend on exactly what you want to put in your snippet of code.

Leave a Comment