Friday, October 19, 2012
1:36 PM

Shell script execute command and store in variable

This Post shows how to execute command in .sh files ie shell script files

Example:

cmd=$(ps -ef | grep tcpdump | awk '{print $3}')
echo $cmd

in .sh files need to use like this variable=$(command)

0 comments:

Post a Comment