linux系统英文论文,Linux系统exec命令(国外英文资料).doc

Linux系统exec命令(国外英文资料)

Linux系统exec命令(国外英文资料)

Shell's built-in exec command will not start a new shell, but with the command to be executed by the shell to replace the current process, and will clean up the environment of the old process, and other orders will be executed no longer after the exec command.

So, if you are in a shell, an exec ls, then, after the lists the current directory, the himself out of the shell, because the process of the shell has been replaced with the implementation of the ls command only one process, perform over nature also dropped out. To avoid this influence our use, the exec command in a shell script, use the script to invoke this script, call point can use bash a.s h, (a.s h is to store the command scripts), which can build a sub for a.s h shell to carry out, after the execution to exec, the child script process has been replaced by the corresponding exec command.

The source command or ". "will not create a new shell for the script, but simply execute the command that the script contains in the current shell.

Attention should be paid to an exception, however, when the exec command to the file descriptor operation, will not replace the shell, and the operation is done, will continue to follow the orders.

Exec 3 < & 0: the command is to point the operator 3 to the standard input.

In addition, this command can also serve as an option for the find command, as shown below:

(1) in the current directory (including subdirectories), find all TXT files and find the lines that contain the string "bin"

/ -name "*.txt" -exec grep "bin" {} \;

(2) delete all TXT files in the current directory (including subdirectories)

/ -name "*.txt".

To summarize a table:

Exec command action

Exec ls executes ls in the shell and does not return to the original shell after ls

Exec < file as the standard input for exec

Exec > file writes the contents of the file as standard

Exec 3 < file reads the file into fd3

The content read in sort < &3 fd3 is classified

Exec 4 > file will be written to

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值