有些内部命令在目录列表时是看不见的,它们由shell本身提供,常用的内部命令有echo eval exec export readonly read shift wait exit和点(.)
其中加了底纹是常用的变量
shift这个比较特殊,应用这个参数之后,你用$#会发现,如果你定义的是3个参数,可是显示出来的却是2个参数,而且,每个参数对应的参数值都会少1,如图:
[[email protected] zhouyu]# set -- i am zhouyu
[[email protected] zhouyu]# echo $1 $2 $3
i am zhouyu
[[email protected] zhouyu]# echo $1
i
[[email protected] zhouyu]# echo $2
am
[[email protected] zhouyu]# echo $3
zhouyu
[[email protected] zhouyu]# shift
[[email protected] zhouyu]# echo $1
am
[[email protected] zhouyu]# echo $2
zhouyu
[[email protected] zhouyu]# echo $3
[[email protected] zhouyu]#
[[email protected] zhouyu]# echo $#
2
[[email protected] zhouyu]# shift
[[email protected] zhouyu]# echo $1
zhouyu
[[email protected] zhouyu]# echo $2
[[email protected] zhouyu]# echo $3
[[email protected] zhouyu]# echo $#
1
[[email protected] zhouyu]#
后续更新