colors in BASH, doubt with script

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting colors in BASH, doubt with script
# 1  
Old 11-19-2007
colors in BASH, doubt with script

I was trying to see all combinations of foreground and background colors in BASH.

This works fine for me,
echo -e '\E[37;46m TEXT'

but when I tried the below script, the variables i and j do not expand.


for i in `seq 30 37` # foreground
for j in `seq 40 47` #background
echo -e '\E[$i;$jm TEXT'
tput sgr0 # Reset text attributes to normal without clear

I tried

echo -e "\E[$i;$jm TEXT"
echo -e '\E["'"$i"'";"'"$j"'"m TEXT'

no luck, please help.
# 2  
Old 11-19-2007
Originally Posted by jaduks
Here you are not using bash.
# 3  
Old 11-19-2007
yes porter, but anyway it does not work :-)
# 4  
Old 11-19-2007
regarding colors in bash

try this
echo -e '\E['$i';'$j'm TEXT'

normally /bin/sh is a link to /bin/bash
if not sure, check out this
ls -las `which sh`

# 5  
Old 11-19-2007
Hey RUV,
it worked !
Thanks a lot.

you are correct about sh/bash thing :-)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "" script and a "" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies

2. Shell Programming and Scripting

Bash script: problem with a function which use colors

Hello guys :) I've a some issue with a function which use the bash colors in my script. An example : #!/bin/bash set -x log_in(){ host="srv1" remote_files="log/" LOG_FILE="logfile" green='\033]; then color_in_red=("${red}"$2"${none}") echo -e... (2 Replies)
Discussion started by: Arnaudh78
2 Replies

3. Shell Programming and Scripting

Bash shell scripting doubt

Hello All, I am setting up a cron job, where i am calling a shell script to make few builds. I got struck at a point, need some expert inputs to proceed further. The script is categorized in 5 parts and in the last part while building software it asks for few questions like:- 1. Build mode... (4 Replies)
Discussion started by: sahil_jammu
4 Replies

4. Shell Programming and Scripting

Bash 'shopt' doubt

Hi, I am using bash shell's extended pattern matching. What tweak the following code needs in order to get the expected output? shopt -s extglob f="a@b@_c@d@_e" echo "${f/@(@|@_)/__}" My expected output is: a__b__c__d__e but the actual output is: a__b@_c@d@_e # that is, how to... (3 Replies)
Discussion started by: royalibrahim
3 Replies

5. Shell Programming and Scripting

Perl script doubt?

Dear friends, I have two files. In first file first column ($1), i have numbers. The second file containes, the same number in the fourth column($4). I need a output file, matching the first file column 1 with second file column 4. The main thing is the output file lines will be sorted... (4 Replies)
Discussion started by: vasanth.vadalur
4 Replies

6. UNIX for Advanced & Expert Users

i have a doubt with the awk script??

Hi Guys, I am new to this forum, i have doubt with a awk script. I want to generate a list where i can busiest hour from a list of a data. 05/19/2008 14:27:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0 05/19/2008 14:28:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0 05/19/2008 14:29:19 -... (2 Replies)
Discussion started by: asirohi
2 Replies

7. UNIX for Dummies Questions & Answers

Colors in Ksh Script

Hi All, is it poosible to Print the error messages in colors.., i am using KSH..., i have tried the following, echo "\033 Hi This is Sam!!! But, when i tried to redirect in to a log file, i am getting as follows, echo "\033 1 line, 31 characters ^[[34m Hi This is Sikki!!! ^[[0m ... (0 Replies)
Discussion started by: Serious Sam
0 Replies

8. Shell Programming and Scripting

Bash scripting doubt

i need to check if any user has logged-in more than once in different terminals and then print the count of those login, so i wrote this command, who -H | wc -l but i feel its not accurate , something is wrong ,i have been trying for a long time by trial n error to solve it, but i need... (2 Replies)
Discussion started by: xiphias
2 Replies

9. Shell Programming and Scripting

colors in ksh script

hello! I'd like to print on screen amessage. What can I do to print this message with blue fonts. thanks... (4 Replies)
Discussion started by: hoang
4 Replies

10. UNIX for Dummies Questions & Answers

Changing korn shell script text Menu colors?

Is it possible to change the color of text in a korn shell script Menu? I can change the color of session text through my telnet client but I want to be able to change color text in the Korn shell menu to highlight certain items. (6 Replies)
Discussion started by: darthur
6 Replies
Login or Register to Ask a Question