Register
It is currently Fri Oct 31, 2014 1:40 am

Adding linefeeds to the output of a grep command


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Mon Dec 12, 2011 10:45 pm   

Joined: Mon Dec 12, 2011 10:37 pm
Posts: 1
Hi

I have the following code
Code:
#!/bin/bash
JOBS=`ps -ef | grep xterm`
echo $JOBS


The output is one long line, which is very hard to read. Is there a way to insert linefeeds and so replicate the effect of typing
Code:
ps -ef | grep xterm

from the command line?

Thanks very much for your help


Top
 Profile  
 PostPosted: Mon Dec 12, 2011 11:56 pm   
User avatar

Joined: Sun Jun 27, 2010 12:57 am
Posts: 192
yes, put quotes around your variable:
Code:
echo "$JOBS"


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP