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?


/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

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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