Thursday, 18 October 2012

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)

Share This!



No comments:

Post a Comment

Here We Write The Problems we face at different situations and Solutions to those problems.