I am going through ,this answer here Understanding the -exec option of `find`
I am not able to understand, how below piece of code works
sh -c 'echo "hello $1" ' somestring works
How does that work,if i remove somestring
,it doesn't even work..
I tried searching with keywords like sh -c examples
,but its not yielding any results
sh -c 'some shell code' sh
? – Kamil Maciorowski Sep 13 '22 at 03:40somestring
will be the name of the script. Try using:sh -c 'echo -e "Filename: $0\nhello $1" '
. The first argument after sh -c '...' it's the name of the script and the following values are the parameters passed to that script. You should check the link that @KamilMaciorowski provided. – Edgar Magallon Sep 13 '22 at 03:56