曹耘豪的博客

Linux下的命令参数

1
2
3
4
5
6
7
8
9
10
11
echo 'Current PID: '$$
echo 'Last PID: '$!
echo 'Last result code: '$?
echo 'set' $-
echo 'args($*): '"$*"
echo "args($*): ""$*"
echo 'arge($@): '"$@"
echo "arge($@): ""$@"
echo 'arges num: '$#
echo 'shell file full name: '$0
echo 'args: '$1 $2
1
2
3
4
5
6
7
8
9
10
11
12
# sh ~/Desktop/test.sh aa bb cc dd ee ff gg hh ii jj kk
Current PID: 96811
Last PID:
Last result code: 0
set hB
args($*): aa bb cc dd ee ff gg hh ii jj kk
args(aa bb cc dd ee ff gg hh ii jj kk): aa bb cc dd ee ff gg hh ii jj kk
arge($@): aa bb cc dd ee ff gg hh ii jj kk
arge(aa bb cc dd ee ff gg hh ii jj kk): aa bb cc dd ee ff gg hh ii jj kk
arges num: 11
shell file full name: /Users/root/Desktop/test.sh
args: aa bb
   /