bash shell parameters
You can use the command ` echo $SHELL` to determine user's or system shell. I came across this today:-
echo ${0} and that produces the same thing. I've checked with man bash but I've not seen (or noticed) that use of parameters are there any docs that mention this use? |
Just like the positional variables $1, $2, ... represent argument 1, argument 2, ... the variable $0 represents argument 0, which in Unix is the path used to execute the current process.
|
So, if you excecute `echo $0` in a terminal, it will probably show you the name of the shell, because the shell is the current process. I am not sure but I will try it. This will probably not apply in a shell script.
|
From bash man page:
Code:
0 Expands to the name of the shell or shell script. This is set at shell initialization. |
Well it partially works.
In konsole: #echo $0 /bin/bash In xterm: #echo $0 bash In yakuake #echo $0 -l The last was probably because: Quote:
|
All times are GMT -5. The time now is 04:41 PM. |