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

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.