echo switches

Login or Register for Dates, Times and to Reply

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting echo switches
# 1  
echo switches

Hello All,

I am writing an shell script but abruptly its not able to recognize switches in echo statement.


top -n 1 -b>ankit


time=`cat ankit|grep load|tr -s " "|cut -d " " -f3`

load=`cat ankit|grep load|tr -s " "|cut -d "," -f4|cut -d ":" -f2`

mem=`cat ankit|grep Mem`

swp=`cat ankit|grep Swap`

echo "Machine Name: $host">>mcs

echo "Time when snapshot taken $time">>mcs

echo "\n\n current Load Average of the system is$load">>mcs

echo "\t\t Memory Utiliztion on the server">>mcs


cat mcs|mail -s "Top Usage Report"


Machine Name: zin33cde01
  Time when snapshot taken 16:18:45
  current Load Average of the system is 5.45 \t\t Memory Utiliztion on the server


like in the above output ist not parsing \t\t for tabing.


Moderator's Comments:
Mod Comment
Please use code tags when posting data and code samples!

Last edited by vgersh99; 05-23-2011 at 08:22 AM.. Reason: code tags, please!
# 2  
try with `-e `
echo -e "\t\t Memory Utiliztion on the server">>mcs

# 3  
echo switches

Thanks for your reply.Can you please let me know why its not running without -e.

Can you also let me know how can i highlight important things using the script link bold or italics the text.


# 4  
Originally Posted by ajaincv
Thanks for your reply.Can you please let me know why its not running without -e.

Can you also let me know how can i highlight important things using the script link bold or italics the text.


backslahs is interpreted in \t \n \r with `-e`
-e     enable interpretation of backslash escapes

for other question you can look this page Smilie
Colorizing Scripts

Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #369
Difficulty: Medium
The name bytecode originates from instruction sets that have zero-byte opcodes followed by optional parameters.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read Strings in as options to switches

I have a script using getops with -a -t -l as potential switches, based on the switches used, it will set the respective variable value which will cause the routine/function to run. I need to also pass a string with the switch that will get parsed by the function. example ./myscript -a... (8 Replies)
Discussion started by: glev2005
8 Replies

2. AIX

LACP between AIX 7.1 and HP procurve switches

Hi. On a standalone AIX server, 7.1 version, I have 3 connected gigabit ethernet ports. I made an etherchannel like this : # lsattr -El ent4 adapter_names ent1,ent2 | EtherChannel Adapters True alt_addr 0x000000000000 | Alternate EtherChannel Address True auto_recovery yes | Enable... (1 Reply)
Discussion started by: stephnane
1 Replies

3. Shell Programming and Scripting

Finding when a file switches direction using awk

Hi guys I have a file that is filled with x,y values: 0.000000 0.00129578 0.000191 0.00272187 0.000381 0.0125676 0.000572 0.0120014 0.000763 0.00203461 0.000954 0.00682248 0.001144 0.00202773 0.001335 0.000840523 0.001526 0.00451419 ....5MB of that I wanted to know if there is a... (7 Replies)
Discussion started by: bflinchum
7 Replies

4. Shell Programming and Scripting

Multiple commandline switches

I have a script that has commandline switches that work no problem. But i don't know how to enable it to have multiple switches at one time. So I'd want myscript -h -o or even myscript -ho but i'm having no luck incorporating this. I tried shifting but i'm not getting it. Thanks ----------... (0 Replies)
Discussion started by: DC Slick
0 Replies

5. Infrastructure Monitoring

Nagios monitoring for switches.

Hi, I have configured check_snmp plugin and using the plugin i am able to monitor the uptime of the switch. But the following fails # /usr/local/nagios/libexec/check_snmp -H -C ready -o ifOperStatus.1 -r 1 -m RFC1213-MIB SNMP CRITICAL - *down(2)* | # Any suggestions ? (1 Reply)
Discussion started by: uxadmin007
1 Replies

6. Shell Programming and Scripting

Collect information from switches

Hi All , In my environment we have 12 SAN switches .Culd u pls help me for below queries . would like to telnet to all switches and collect information in daily basis with "switchstatus" command and store the output under /tmp/ folder on systemA . To keep passwords of 12switches in a... (1 Reply)
Discussion started by: chinni-script
1 Replies

7. IP Networking

LACP aggregation on separates switches

Hello, I'm working on LACP architecture. I would like to know if it's possible to aggregate two links on two separate switches. Here an example I want : Aggregation of link1 and link2 to obtain a logical 2 gbit/s link. Also have redundancy, if one of them is down, the traffic goes through the... (1 Reply)
Discussion started by: jbemonet
1 Replies

8. Programming

Signal Handling and Context Switches

Hi guys, this is my first posting, so at first hi to everyone! ;) I have a problem with ucontext_t in connection with signal handling. I want to simulate a preemptive scheduler. I am using the iTimer with ITIMER_PROF, to schedule the interrupts. You find the code below: #include <stdio.h>... (18 Replies)
Discussion started by: XComp
18 Replies

9. UNIX for Advanced & Expert Users

xterm switches to make fonts larger

Dear Sirs I posted this question to "Unix for dummies" but got no answers, so I'm asking help from this group. Whenever I bring up an xterm window on my laptop running Mandrivia Linux, the font in the xterm window is so small that it is practically unreadable ! What switches do I need to... (1 Reply)
Discussion started by: kanejm
1 Replies

10. UNIX for Advanced & Expert Users

Tar switches!!!

Hi, If i want to write my data on several tapes, (more than one tape), what switch(s) i need to use with tar. In other word if my data needs the sapce more than one tape & i don't wanna to compress or ... my data. so is it possible to write up to the end of the tape & it asks to put another... (1 Reply)
Discussion started by: nikk
1 Replies

Featured Tech Videos