awk内部调用外部shell命令
2011-01-04 15:12
519 查看
Reference:http://www.computing.net/answers/unix/awk-command/6949.html
awk uses the system function to execute any OS command, and the
return code can be captured and checked, as shown below. You can also
read in all the output of a system call (very handy).
When I check
the code returned from the OS, zero means success. But within awk, a
zero expression means false and non-zero means true. If you run the
code below, you will see that "one means true".
awk uses the system function to execute any OS command, and the
return code can be captured and checked, as shown below. You can also
read in all the output of a system call (very handy).
When I check
the code returned from the OS, zero means success. But within awk, a
zero expression means false and non-zero means true. If you run the
code below, you will see that "one means true".
awk 'BEGIN { rc=system("test -f myfile") if (rc==0) print "exists" else print "does NOT exist" if (system("test -f myfile")) print "does NOT exist" else print "exists" if (0) print "zero means true" if (1) print "one means true" exit}'
相关文章推荐
- awk内部调用shell命令 -- shell
- perl调用外部命令(g)awk的方法
- awk 调用 shell 命令,并传递参数
- android 在win7的cmd中输入adb shell提示不是内部或外部命令
- awk调用shell命令 getline system
- Awk中调用shell命令
- 在cmd当中输入adb shell,提示不是内部或外部命令
- shell内部命令和外部命令
- 在cmd当中输入adb shell,提示不是内部或外部命令
- QT中调用shell或外部命令
- python中如何调用shell等外部的命令
- 在cmd当中输入adb shell,提示不是内部或外部命令
- 小时代5-perl调用外部命令awk的方法
- awk调用shell命令的两种方法:system与print
- Linux中 别名、内部命令、外部命令、hash缓存表 系统调用时的优先级比较
- awk调用shell命令与getline和system函数
- Qt下调用外部命令或Shell脚本
- Android开发时在windows中输入adb shell提示不是内部或外部命令
- awk调用shell命令
- shell内部命令和外部命令