1

Possible Duplicate:
Storing output of command in shell variable

How can I put the result of jps | awk '$2~/Bootstrap/{print $1}' into a variable so that I can use with other commands?

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232

1 Answers1

2

Wrap it in $( ... )

xyzzy=$(jps | awk '$2~/Bootstrap/{print $1}')
echo $xyzzy

this creates a subshell the output of which is captured into xyzzy.