Use the exec command of linux to invoke and execute the specified command
This article mainly introduces the use of linux exec command call and execute the specified command, the text is very detailed, has a certain reference value, interested friends must read!
The exec command is used to invoke and execute the specified command. The exec command is usually used in shell scripting programs and can invoke other commands. If a command is used in the current terminal, the terminal exits immediately after the specified command is executed.
Syntax format: exec [parameter]
Common parameters:
-c Executes specified command in empty environment
Reference Example
First, use the echo command to convert the text "Welcome to use Linux! "Export:
[root@linuxcool ~]# echo Welcome to use Linux! Welcome to use Linux!
Then use the exec command to call the echo command to output the same information, and compare the output information:
[root@linuxcool ~]# exec -c echo Welcome to use Linux! Welcome to use Linux!
Find files belonging to Jake users and copy them to the/findfiles directory:
[root@linuxcool ~]# find / -user Jaking-exec cp -Ra {} /findfiles \; The above is all the contents of using the linux exec command to call and execute the specified command. Thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!