linux shell 变量表示
来源:互联网 发布:刘宇的喜欢lofter乐乎 编辑:程序博客网 时间:2024/06/06 14:18
一、linux shell 变量表示:
$# 是传给脚本的参数个数
$
0
是脚本本身的名字
$
1
是传递给该shell脚本的第一个参数
$
2
是传递给该shell脚本的第二个参数
$@ 是传给脚本的所有参数的列表
$* 是以一个单字符串显示所有向脚本传递的参数,与位置变量不同,参数可超过
9
个
$$ 是脚本运行的当前进程ID号
$? 是显示最后命令的退出状态,
0
表示没有错误,其他表示有错误
二、这些变量的使用方法
例子:sh文件:dels.sh
##dels.sh
echo "number:$#"
echo "scname:$0"
echo "first :$1"
echo "second:$2"
echo "argume:$@"
echo "show parm list:$*"
echo "show process id:$$"
echo "show precomm stat: $?"
执行结果:
[@jihite]$ sh del.sh
1
2
3
number:
3
scname:del.sh
first:
1
second:
2
argume:
1
2
3
show
parm list:
1
2
3
show
process id:
21057
show
precomm stat:
0
0 0
- linux shell 变量表示
- linux shell 特殊符号的表示
- linux shell 特殊符号的表示
- linux shell 特殊符号的表示
- Linux Shell 之 Shell 变量
- shell sed中引用shell变量及空格表示方法
- shell sed中引用shell变量及空格表示方法
- Linux Shell变量使用
- linux shell 变量设置
- Linux的shell变量
- linux中shell变量
- linux shell 中的变量
- Linux Shell变量
- Linux Shell 一些变量
- linux特殊shell变量
- linux中shell变量
- linux shell变量说明
- linux中shell变量
- poj 2586 Y2K Accounting Bug
- Can not find a java.io.InputStream with the name [targetFile] in the invocation stack.
- 005:What's the best way to iterate over the items in a HashMap?
- 遥感与GIS(c#编写)
- Python黑帽编程2.1 Python编程哲学
- linux shell 变量表示
- Java IO(四):FileInputStream
- nodejs微信公众号开发第六章:人机聊天进阶版语音聊天
- JavaScript HTML JSP 值传递
- iOS layoutSubviews的作用和调用机制
- Android Studio基本设置
- Java IO(五):FileOutputStream
- 奇偶规则和非零环绕数规则
- ORACLE系统表静态数据字典,常用user视图表及其常用用法