shell编程
Yang-Zheng
linux
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Linux中变量$#,$@,$0,$1,$2,$*,$$,$?的含义
$# 是传给脚本的参数个数 $0 是脚本本身的名字 $1 是传递给该shell脚本的第一个参数 $2 是传递给该shell脚本的第二个参数 $@ 是传给脚本的所有参数的列表 $* 是以一个单字符串显示所有向脚本传递的参数,与位置变量不同,参数可超过9个 $$ 是脚本运行的当前进程ID号 $? 是显示最后命令的退出状态,0表示没有错误,其他表示有错误原创 2014-11-10 09:07:38 · 1057 阅读 · 0 评论 -
shell编程—if语句
if 语句格式 if 条件 then Command else Command fi 别忘了这个结尾 If语句忘了结尾fi test.sh: line 14: syntax error: unexpected end of fi if 的三种条件表达式转载 2014-08-15 08:56:19 · 1155 阅读 · 0 评论 -
shell $*,$@,$#的区别详解
[yangzheng@localhost shell_test]$ cat test.sh echo index=1 echo "Listing args with\"\$*\":" for arg in "$*" do echo "Arg #$index=$arg" let "index+=1" done echo "All t原创 2014-08-15 10:10:04 · 1511 阅读 · 0 评论 -
Linux中profile、bashrc、bash_profile之间的区别和联系
/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.并从/etc/profile.d目录的配置文件中搜集shell的设置. 英文描述为: # /etc/profile # System wide environment and startup programs, for login setup # Functions and al转载 2014-08-08 17:28:08 · 524 阅读 · 0 评论 -
linux 别名
命令格式: alias [alias-name=’original-command’] 其中,alias-name是用户给Linux Bash命令取的别名,original-command是原来的Bash命令和参数。需要注意的是,由于Linux Bash命令是以空格或者回车来识别原来的命令的,所以如果不使用引号就可能导致Linux Bash命令只截取第一个字,从而出现错误。如果alias命令后面不原创 2014-08-08 16:38:54 · 822 阅读 · 0 评论
分享