how do i confirm when do i need to add "/bin/sh -c and when not ?
There is no specific condition when to use or when not. Instead of that, we have to try to know the meaning.
-c string If the -c option is present, then commands are read from string.
same as we passed in the
command: ["/bin/sh", "-c", "command (e.g. sleep 4500)"]
> command: ["/bin/sh"," -c",“sleep 3600”]
> command: [“sleep 3600”]
first one will work, but for second, it won’t work. It’ll assume one parameter.