Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 273
  • Last Modified:

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?
0
mokkan
Asked:
mokkan
8 Solutions
 
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
 
woolmilkporcCommented:
Omit echo or use quotes:

/sbin/lltstat -nvv active >> $LOG

echo "`/sbin/lltstat -nvv active`" >> $LOG
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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now