Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am considering adding the following echo command to /etc/profile

echo -e ‘\033[9;0]\033[14;0]’

The system in question does not have setterm command available and is just running text console.

Are there any problems with doing this the way I plan to?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

/etc/profile is read by several Bourne-like shells. echo -e is not standard, so there might be some shells on your system that don't recognize it. You should use printf instead.

printf '\033[9;0]\033[14;0]'

(which in addition, won't add that spurious newline character).

Some tools may start non-interactive login shells (like with bash --login) where you may not want that to happen. You could add extra checks like:

case $TERM$- in
  (linux*i*) printf '\033[9;0]\033[14;0]' > /dev/tty
esac

To check that you're in a Linux virtual console and that it is an interactive shell. Outputting to the controlling terminal in case stdout has been redirected.

share|improve this answer
    
Thanks. This is what I was looking for. –  Plazgoth Nov 29 '12 at 10:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.