View Single Post
peterleinchen's Avatar
Posts: 4,118 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#78
You want output to store in a variable?

Normally I use version c
Code:
cat /proc/swaps | awk '/dev/ {print $1}'
awk '/dev/ {print $1}' /proc/swaps

a=cat /proc/swaps | awk '/dev/ {print $1}'
echo $a
b=awk '/dev/ {print $1}' /proc/swaps
echo $b

c=`cat /proc/swaps | awk '/dev/ {print $1}'`
echo $c
d=$(awk '/dev/ {print $1}' /proc/swaps)
echo $d
Or what?

Last edited by peterleinchen; 2012-07-12 at 21:40. Reason: corrected accidentally wrong brackets in version d after seeing vi_s post
 

The Following 2 Users Say Thank You to peterleinchen For This Useful Post: