echo behavior varies with shell, whereas printf behavior is consistent.
for your echo script following will work, but I would recommend to use printf version
Ok,
I have added some color to my prompt, but I never tried to color my command outputs. I have tried the examples above on my CentOS and Mac computers and there was no color add to the out put. What happens is the above echo statements changes my prompt and the printf puts the out put in front of my prtompt. What am I missing here?
Ok,
I have added some color to my prompt, but I never tried to color my command outputs. I have tried the examples above on my CentOS and Mac computers and there was no color add to the out put. What happens is the above echo statements changes my prompt and the printf puts the out put in front of my prtompt. What am I missing here?
To have you prompt showed in red, just replace the line below in /etc/bashrc to the later one:
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="\e[1;31m[\u@\h \W]\\$\e[0m "
Hello!
I need to write a bash script for my university classes, and I came up with an idea of a program that would test the speed of typing - there is some random text that you have to rewrite, and the script measures time, number of mistakes etc. The text would be visible on the screen all... (3 Replies)
Hey everyone,
I have come across an issue to where I am trying to create a script which changes the text color with a simple if then statement. I have seen it done with Fedora 8 but when I try and create it using my MacBook Pro running Snow Leopard it doesn't work. Funny thing is, when I use... (2 Replies)
hello
im looking for an easy way to color specific strings in text file.
simple example:
cat file1
acb 1234
qwer 5678
my goal:
cat file1 (color the acb red and the 5678 blue)
acb 1234
qwer 5678
cheers (2 Replies)
Does anyone of you know how to turn off color and weird characters on bash shell when using the command "script"? Everytime users on my server used that command to record their script, they either couldn't print it because lp kept giving the "unknown format character" messages or the print paper... (1 Reply)