Sudi Krishnakumar:
Hello all!
I have a super basic question on command options…
In the below command
kubectl run box-test --image=busybox --restart=Never -it --rm -- /bin/sh -c "wget -O- IP"
What would be the difference if I were to do this instead?
They both seem to do the same thing… I understand that in the first command we are forcing it to use sh
but what is the -c
option?
kubectl run box-test --image=busybox --restart=Never -it --rm -- "wget -O- IP"
Marko Eremija:
-c Take the first argument as a command to execute, rather than reading commands from a script or standard input. If any further arguments are given, the first one is assigned to $0, rather than being used as a positional parameter.
Alistair Mackay:
sh -c
tells shell to execute the command in quotes that follows.
This is required if you are trying to execute something that is made up of shell built-in commands like if
, while
etc.
If you only want to run an executable program like wget
you don’t need to use the shell to run it.
Sudi Krishnakumar:
Brilliant! thanks again