shuxuef said:Hi,
By editing the file /etc/issue, one can change the pre-login message. Does anyone know how to make it use different colors for the text? I just thought it might be useful to highlight some keywords. Thanks!
echo -e "\e[1;37mWelcome to the\e[0m \e[1;36m`hostname | tr '[a-z]' '[A-Z]'` UNIX SERVER\e[0m"!
echo
UNIXgod said:/etc/issue did you mean motd()?
I have a welcome message in my shell's rc file which is in color.
You can do colors with escaping. Here is an example:
Code:echo -e "\e[1;37mWelcome to the\e[0m \e[1;36m`hostname | tr '[a-z]' '[A-Z]'` UNIX SERVER\e[0m"! echo
shuxuef said:Thanks!
But yes, I do mean /etc/issue. The one that's quoted by /etc/gettytab for the message before the login prompt, not after. And the escaping doesn't seem to work.
echo -e "\e[1;37mWelcome to the\e[0m \e[1;36m`hostname | tr '[a-z]' '[A-Z]'` UNIX SERVER\e[0m"! >>/path/to/file
UNIXgod said:You can do colors with escaping. Here is an example:
Code:echo -e "\e[1;37mWelcome to the\e[0m \e[1;36m`hostname | tr '[a-z]' '[A-Z]'` UNIX SERVER\e[0m"! echo
printf "\033[1;37mWelcome to the\033[0m \033[1;36m`hostname | tr '[a-z]' '[A-Z]'` UNIX SERVER\033[0m!"
ph0enix said:I bet it works. What happens when you just copy and paste the line posted by UNIXGod into a terminal window (assuming your terminal is color capable)?
In order to insert the escape sequences into a file, you need to do something like this:
...instead of editing the file in a text editor and pasting them in.Code:echo -e "\e[1;37mWelcome to the\e[0m \e[1;36m`hostname | tr '[a-z]' '[A-Z]'` UNIX SERVER\e[0m"! >>/path/to/file
Hope this helps!
J.