Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Unix/Linux basic script question

Posted on 2015-01-28
8
Medium Priority
?
261 Views
Last Modified: 2015-02-18
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?
0
Comment
Question by:mokkan
8 Comments
 
LVL 9

Assisted Solution

by:Trenton Knew
Trenton Knew earned 752 total points
ID: 40575619
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
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 504 total points
ID: 40575624
Omit echo or use quotes:

/sbin/lltstat -nvv active >> $LOG

echo "`/sbin/lltstat -nvv active`" >> $LOG
0
 
LVL 9

Assisted Solution

by:Trenton Knew
Trenton Knew earned 752 total points
ID: 40575628
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 504 total points
ID: 40575630
@Trenton - please look a bit closer.  The asker uses backticks, not single quotes.
That's what we call "command substitution".
0
 
LVL 9

Assisted Solution

by:Trenton Knew
Trenton Knew earned 752 total points
ID: 40575637
ah, sorry... my bash skills are still developing.
0
 
LVL 36

Assisted Solution

by:Seth Simmons
Seth Simmons earned 248 total points
ID: 40575642
$LOG is a variable, has it been defined?

if it wasn't defined, bash would have returned an ambiguous redirect
0
 
LVL 62

Assisted Solution

by:gheist
gheist earned 248 total points
ID: 40576140
It looks like a line from shell script, not a BASIC script.
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 248 total points
ID: 40576700
How the output of

/sbin/lltstat -nvv active | wc -l

looks like? Is it single line?
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question