Solved

Unix/Linux basic script question

Posted on 2015-01-28
8
227 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 188 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 126 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 188 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
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 126 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 9

Assisted Solution

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

Assisted Solution

by:Seth Simmons
Seth Simmons earned 62 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 61

Assisted Solution

by:gheist
gheist earned 62 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 62 total points
ID: 40576700
How the output of

/sbin/lltstat -nvv active | wc -l

looks like? Is it single line?
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now