What does $# mean in shell? I have code such as if [ $# -eq 0 ] then I want to understand what $# means, but Google search is very bad for searching these kinds of things.
Shell - "Shell" is a program, which facilitates the interaction between the user and the operating system (kernel). There are many shell implementations available, like sh, Bash, C shell, Z shell, etc.
I often come across $?, $0, $1, $2, etc in shell scripting. I know that $? returns the exit status of the last command: echo "this will return 0" echo $? But what do the others do? What ...
I understand the basic difference between an interactive shell and a non-interactive shell. But what exactly differentiates a login shell from a non-login shell? Can you give examples for uses of...
$! is the PID of the most recent background command. $0 is the name of the shell or shell script. Most of the above can be found under Special Parameters in the Bash Reference Manual. Here are all the environment variables set by the shell. For a comprehensive index, please see the Reference Manual Variable Index.
The shell will try to create directory test and then, only if it was successful will try create file inside it. So you may interrupt a sequence of steps if one of them failed.
docker debug <container or image> It allows you to get a shell (bash/fish/zsh) into any container. It also works for stopped containers and images. Essentially it's a replacement of docker exec -it <container> sh but with more features and less constraints (eg the debug shell has an install command to add further tools).
The Bash shell supports two ways to do arithmetic operation, one defined by the built-in let command and the other the $((..)) operator. The former evaluates an arithmetic expression while the latter is more of a compound statement.