Create a fancy issue file

The file /etc/issue is used as a pre-login message on a linux console. Use this script as this:

$ ./update-issue.sh > issue
$ sudo mv -f issue /etc/issue && rm -f issue
issue file example
Issue file looks like this when colors get rendered. — The escaped characters are only rendered on the console though.
#!/bin/sh
#
# Prints fancy colored text for login screens
# You need to pipe the output to a specific file like:
#   ./update-issue.sh > output-file.txt
# Author: Dominic Reich <dominic@tmsn.at>
# Last modified: Mittwoch, 20.05.2015 16:35

#spaces()
#{
# COUNT=0;
# while [ $COUNT -lt $1 ];
# do
#   echo -ne " ";
#   COUNT=$[$COUNT+1];
# done
#}

#esc="\033["
#echo -ne "${esc}H${esc}J\n${esc}0;34;1m"
#WELCOME="Arch Linux "`uname -r`" on "`hostname -f`" \t"
#CHARS=$[(80-`echo $WELCOME | wc --chars`)/2]
#echo -ne $WELCOME `spaces $CHARS`
#echo -ne $WELCOME
#echo -ne "${esc}0m\n "

echo -ne "\033[0;37;1mGentoo Linux\033[0m on\033[0;33;1m \\\\n\\.\\\\O\033[0;37;1m (\033[0;34;1m\\\\s \\\\m \\\\r\033[0;37;1m)\033[0;37;1m (\033[0;31;1m\\\\l\033[0;37;1m)\033[0;32;1m \\\\t\033[0m\n\n"

Leave a Comment