The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-19-2007
jaduks's Avatar
jaduks jaduks is offline
Registered User
  
 

Join Date: Aug 2007
Location: Assam,India
Posts: 167
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.

#!/bin/sh

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



I tried

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

no luck, please help.