Meaning of $0, $1 in shell
What is the meaning of $0, $1 etc in shell?
When I type $0 in ubuntu terminal, I get written as bash. When I type $1 , $2etc and hit Enter, nothing appears on next line. Please Explain |
Code:
#!/usr/bin/env bash ./script ..... |
Thanks alott!!
Quote:
|
$1 and above are positional parameters which relate to a script's arguments - the Bash documentation for which is at https://www.gnu.org/software/bash/ma...nal-Parameters, and the POSIX specification is at https://pubs.opengroup.org/onlinepub...l#tag_18_05_01
$0 is a Special Parameter which expands to the name of the shell or script being run. Another special parameter is $# which is the number of positional parameters. |
Thanks!!!!!
Quote:
|
BTW: there is a lovely MAN page for BASH that should be installed on your system. I go back and read it about once a year, to rediscover useful things I might otherwise forget.
|
All times are GMT -5. The time now is 07:30 PM. |