> if [ `tty` = "/dev/tty1" ]; then A typo -- a single = is used to assign values, not compare them. The script should use ==, thusly: if [ `tty` == "/dev/tty1" ]; then