I have a script I am runing on a hacked CDLinux live CD called from /etc/rc.d/rc.local.
The part of th script in question goes like this.
Quote:
colour() {
case "$1" in
"shout" ) echo -ne "\033[1m\033[41m";;
"welcome" ) echo -ne "\033[1;33m\033[40m";;
"error" ) echo -ne "\033[1;31m\033[40m";;
"info" ) echo -ne "\033[1;36m\033[40m";;
"normal" ) echo -ne "\033[0m";;
* ) echo -ne "\033[0m";;
esac
}
while [ 0 ]; do
colour info
echo -n "Place name :"
read place_name
funnychars=`echo $place_name | tr -d '[a-z][A-Z][0-9] '`
if [ -z "$funnychars" ]; then break; fi
colour normal
echo
echo
colour error
echo "Letters, spaces and numbers only, please. Remove any $funnychars"
echo -n "from name. Try again."
colour normal
echo
done
colour normal
echo
When run from rc.local the prompt "Centre name :" and the colour change does not appear until
after I type the input text and press return. Also, I noticed CTRL-C does not interrupt this script even when it pauses for keyboard input.
When I run the same script after logging from the console it all works as expected with the prompt appearing
before the keyboard input.
Sorry if the colour change code isn't relavent here but I have a long debug loop that involves re-burning the CD to test this script in failure mode, so it's probably quicker to post the whole thing just in case.