Friday, June 21, 2013

Solaris stty: : Invalid argument when running from cron

In Solaris you might have noticed the below definition in ~/.cshrc and ~/.bashrc:
stty erase ^H
This originates the below error when you try to run a scheduled command (non interactive mode):
stty: : Invalid argument
To solve this issue use the below instead:
test -t 0 && stty erase ^H
You use stty to help with some keyboard issues. Oversimplifying, the issue here is that cron runs with no keyboard attached to the session.

No comments: