echo is implementation dependant, i.e. what OS and shell you are using. Some accept the -e option, other don't. Check your man pages.
It might be better to use printf for those printouts as it is standardized across platforms and shells.
As has been said in these forums MANY times before; the behavior of echo, when invoked with any argument containing a backslash (\) or when the first argument starts with a hyphen (-), varies from system to system and shell to shell. And, using terminal escape sequences to set text color varies from terminal (or terminal emulator) to terminal (or terminal emulator). Without knowing what the expansions of the variables in the arguments to your echo command expand to, what shell you're using, what operating system you're using, and how your environment has been initialized, it is hard to guess at what might be going wrong.
The portable way to write those escape sequences to a terminal (or terminal emulator) from a shell is to use printf instead of echo:
And, of course how your terminal or terminal emulator responds to those escape sequences can't be determined from the information you have provided. (But, on many terminals that recognize ANSI terminal escape sequences, it will produce red text).
And, of course how your terminal or terminal emulator responds to those escape sequences can't be determined from the information you have provided. (But, on many terminals that recognize ANSI terminal escape sequences, it will produce red text).
It might be worth a try to query the termcap database (or its replacement terminfo, whatever there is) prior to using escape sequences. For instance:
I have a bash script that starts and stops a game among other things through in.fifo and out.fifo
In game the text comes out gray . Kinda hard to see in game window .
I would like to change it to purple and maybe capitalize it.
#!/bin/bash
#nwservctl.sh
cd... (5 Replies)
My current line command is as follows:
echo -n "text: " ; grep "blah text" ../dir1/filename | wc -l
The output to the screen is as needed, but how do I print to a text file? (9 Replies)
Hi all, I am trying to create a script to read my Windows UUIDs and create mounts in fstab. I know there are different and maybe even better ways to mount Windows partitions at boot time, but I always manually create them in fstab successfully. I do a clean install of Ubuntu often and would like to... (2 Replies)
Hi,
i need to print following text using echo:
/abc dir/c\
so i tried echo "/abc dir/c\
But it gives me error of Incorrect usage, i am using Hamilton cshell in windows Vista. Can any one please help me.
Thanks in advance
Sarbjit (3 Replies)
I've been trying to get the syntax right so I can echo a $var and then text around it or after it. It either wont display text or $var or one overwrites the other at the beginning of the line. Trying to do something like this.
var=1
echo $var"+1.1"
#output expected 1+1.1
Its an older... (3 Replies)
I am poor with scripting;)
I have a file in the following format;
'This is a "test in production" of importance.'
I want to get rid of the spaces inside the "" part only to get the output as,
'This is a "testinproduction" of importance.' (1 Reply)
Hi,
i need replace the slash (/) with a newline (\n) and a tab (\t).
With 'find -type f' in a folder i got this output:
./1999/01/file1
./1999/01/file2
./1999/02/file1
./2000/04/file1
./2000/04/file2
./2000/04/file3
./2000/04/file4
./2000/06/file1
./2000/06/file2
./2000/06/file3... (8 Replies)
I trying to extract certain text from a csv file and then placing it into another csv file, but having problems getting the data to placed in one line with tab separated fields.
Basically would like to have text sent to interfaces.csv in one line seperated by tabs. As it currently places files... (6 Replies)
I have a ksh script that is a login menu for my end users. I would like to have one line of the welcome message flash when there is a system notice about an impending outage.
The welcome message is a series of echo statements which prints a text file "msg of the day" with the status msg.
I tried... (1 Reply)