Unix/Linux basic script question

I am getting the unix command out put and sending into a file, but it is putting all the info in one line.

echo `/sbin/lltstat -nvv active` >> $LOG

What am I doing wrong?
mokkanAsked:
Who is Participating?
 
woolmilkporcCommented:
Omit echo or use quotes:

/sbin/lltstat -nvv active >> $LOG

echo "`/sbin/lltstat -nvv active`" >> $LOG
0
 
Trenton KnewOwner / Computer WhispererCommented:
the command you have there would write the literal string to the $LOG file.  I think you need to remove the "echo" from the command
0
 
Trenton KnewOwner / Computer WhispererCommented:
Just for clarification, are you trying to write the output of the lltstat command to a file?  $LOG is a variable, has it been defined?  echo '/sbin/lltstat -nvv active' will literally output "/sbin/lltstat -nvv active" to your $LOG file.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
woolmilkporcCommented:
@Trenton - please look a bit closer.  The asker uses backticks, not single quotes.
That's what we call "command substitution".
0
 
Trenton KnewOwner / Computer WhispererCommented:
ah, sorry... my bash skills are still developing.
0
 
Seth SimmonsSr. Systems AdministratorCommented:
$LOG is a variable, has it been defined?

if it wasn't defined, bash would have returned an ambiguous redirect
0
 
gheistCommented:
It looks like a line from shell script, not a BASIC script.
0
 
omarfaridCommented:
How the output of

/sbin/lltstat -nvv active | wc -l

looks like? Is it single line?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.