James Vahn wrote:
> > 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
No, you had it right the first time. In the shell test statement a
single = is used for equality testing. Use of == is a bash extension.
You should use = for portable shell programming.
if [ `tty` = "/dev/tty1" ]; then
Of course for something like this I would prefer case.
case $(tty) in
/dev/tty1) : do something ;;
esac
Bob
Attachment:
signature.asc
Description: Digital signature