I have a file
test with the content
#!/bin/sh -c 'echo was called with $0'
I if i execute it it with
./test, i would expect the OS to effectively execute
sh -c 'echo was called with $0' ./test
which to my understanding should result in
was called with ./test.
However, i get the error message
/bin/sh: 0: Illegal option -
What is the reason for this Error?
please note that i understand that there are easier ways to print the arguments, the
echo part is a stand-in for unrelated and more complex things.
cat -E test gives me
#!/bin/sh -c 'echo was called with $0'$ $