Make a note of simple special variables in shell scripts
Variable name | Overview |
---|---|
$0 | Shell script filename |
$1~ | Shell argument value |
$# | Number of shell arguments |
$@ | Get all arguments |
$$ | Shell process number |
Create a file called hello
hello
#!/bin/bash
echo "hello $1"
echo "hello $2"
echo $0
echo $#
echo $@
echo $$
Pass the value takuya`` ryo
.
$ ./hello takuya ryo
Execution result
hello takuya
hello ryo
./hello
2
takuya ryo
86199
I'm still studying, so I'd appreciate it if you could point out any corrections, etc. m (__) m
Recommended Posts