您的位置:首页 > 运维架构 > Shell

Linux---shell 基本操作符及常见符号

2016-10-13 16:34 387 查看

基本操作符

-s: Check if file has size greater than 0 if yes then condition becomes true.
实际应用中,[ -s $file ] 如果$file内容不为空,或者file其实是个folder的话,都返回true

ksh -n
-n Read commands and check them for syntax errors, but do not execute them. Ignored for

interactive shells.

会检查语法中的错误,比如文件中引号是否成对出现等

-h file

True, if file exists and is a symbolic link.如果文件存在并且是是个符号链接。返回true。

-d file

True, if file exists and is a directory. 文件存在并且是目录,返回true

常见符号

$$ 记录脚本运行是的pid,进程号
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: