Sponsored Content
Top Forums Shell Programming and Scripting Echo a colored text with tabs Post 302946854 by Don Cragun on Saturday 13th of June 2015 01:35:16 AM
Old 06-13-2015
Expanding on what RudiC has already said...

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:
Code:
printf '\e[1;31m%s\t%s\t%s\t%s\t%s\e[m\n' "${var[a]}" "$time" "$end" "$day" "$score"

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).
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

blink / flash echo text in a menu

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)
Discussion started by: MizzGail
1 Replies

2. UNIX for Dummies Questions & Answers

is it possible to echo 'some text' every 10 minutes on my screen

is it possible to echo 'some text' every 10 minutes on my screen continues , without cron. (1 Reply)
Discussion started by: vkandati
1 Replies

3. Shell Programming and Scripting

sh: Inserting tabs and moving text to 1 line

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)
Discussion started by: 00000008
6 Replies

4. Shell Programming and Scripting

Insert Tabs / Indent text

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)
Discussion started by: Tonda
8 Replies

5. Shell Programming and Scripting

Help with replacing tabs inside "" with some text/blank

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)
Discussion started by: shmathew
1 Replies

6. Shell Programming and Scripting

Echo Variables and Text

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)
Discussion started by: Grizzly
3 Replies

7. Shell Programming and Scripting

Problem using echo command for text starting with /

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)
Discussion started by: sarbjit
3 Replies

8. Shell Programming and Scripting

Echo variable contents into a text file...

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)
Discussion started by: Ian Pride
2 Replies

9. Shell Programming and Scripting

Using echo, grep and wc and outputing to text file

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)
Discussion started by: ncwxpanther
9 Replies

10. UNIX for Beginners Questions & Answers

Change text color from echo command?

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)
Discussion started by: 222222quick
5 Replies
vte(1)								   User Commands							    vte(1)

NAME
vte - virtual terminal emulator SYNOPSIS
vte [-2] [-A] [-a] [-B image] [-b] [-C] [-c command] [-D] [-d] [-f font] [-g] [-h] [-i] [-k] [-n] [-r] [-S] [-s] [-T] [-t terminal-type] DESCRIPTION
vte is simply a window wrapped around the vte embeddable terminal emulation control, which does most of the work for gnome-terminal. vte is used mainly to test the control. Most users do not need to use vte directly, but use gnome-terminal instead. OPTIONS
The following options are supported: -2 Toggle double buffering. Enabled by default. -A Toggle antialiasing. The default is that of the current GTK+ default. -a Toggle audible bell on/off. If audible bell is enabled, visible bell is disabled. If audible bell is disabled, visible bell is enabled. Audible bell enabled by default. -B image Use image as background. -b Toggle cursor blinking. Enabled by default. -C Open a "console" connection. -c command Fork the specified command. -D Use dingus clicking: as the cursor moves over text matching a certain pattern, the matched text is highlighted and the cur- sor changes shape. Disabled by default. -d Toggle update debugging. Disabled by default. -f font Specify the font to use. Default font is "Sans 12". -g Toggle whether to set geometry hints if font is changed. Enabled by default. -h Toggle highlighting. Disabled by default. -i Toggle whether to obey attempts to set the icon name, if applications running in the terminal request this. -k Toggle whether to keep program running after GTK main loop. Disabled by default. -n Specify the number of scrollback lines. Minumum number of scrollback lines is 100. Default number of scrollback lines is 100. -r Toggle whether to set cursor color to pale red. Disabled by default. -S Toggle launching a shell. Enabled by default. -s Toggle whether to scroll background image along with text. This option is only useful when combined with the -B option. Disabled by default. -T Use transparent background. Overrides the -B option. -t terminal-typeSpecify the terminal type to emulate. EXTENDED DESCRIPTION
vte is designed to emulate the xterm program provided by the X Consortium. In turn, xterm is an almost complete emulation of the DEC VT102 terminal. vte supports the same extensions to VT102 as those provided by xterm, through special escape sequences. xterm is an evolving program. Recent changes to xterm have been been incorporated into vte. This includes emulation of the newer DEC VT220 escape sequences. EXAMPLES
Example 1: Launching the Virtual Terminal Emulator example% vte ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables: VTE_PROFILE_MEMORY Virtualize memory allocation for debugging purposes. EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/vte Executable for virtual terminal emulator ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWvte | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
gnome-terminal(1), xterm(1), libvte(3) NOTES
Written by Johan Steyn, Sun Microsystems Inc., 2004. SunOS 5.10 6 Sep 2004 vte(1)
All times are GMT -4. The time now is 02:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy