Hi All,
I’ve added a bind command to my .kshrc so I can use TAB for filename
completion. The relevant lines are:
TTY=$(tty)
if test “$TTY” != “not a tty”; then bind ‘^I’=complete; fi
It works fine when opening a new Pterm window (tty = “/dev/ttyp*”), and when
running make from PhAB (“not a tty”).
However, under some circumstances, it issues the error:
/bin/sh: /home/pscarter/.kshrc[31]: bind: cannot bind, not a tty.
sh is actually a symlink to ksh. The error occurs when running a shell
script in a pterm ("/dev/ttyp*"), when running make from a pterm
("/dev/ttyp*"), and when running a shell script in text mode ("/dev/con*")
How can I properly check if .kshrc is being run as a script rather than a
terminal session?
Many thanks
Neil
Neil Carter Psychology Department
IT Technician University of Wales Swansea
Wales, United Kingdom
http://psy.swansea.ac.uk/staff/Carter/
I test for the interactive script flag at the beginning of my .kshrc, eg
case $- in
i)
set -o emacs
export EDITOR=vi
export VISUAL=vi
export PS1=’hostname -s
:/bin/pwd
>’
bind ^[[z=list
bind ^I=complete
…
esac
University of Wales Swansea: Psychology Technicians wrote:
Hi All,
I’ve added a bind command to my .kshrc so I can use TAB for filename
completion. The relevant lines are:
TTY=$(tty)
if test “$TTY” != “not a tty”; then bind ‘^I’=complete; fi
It works fine when opening a new Pterm window (tty = “/dev/ttyp*”), and when
running make from PhAB (“not a tty”).
However, under some circumstances, it issues the error:
/bin/sh: /home/pscarter/.kshrc[31]: bind: cannot bind, not a tty.
sh is actually a symlink to ksh. The error occurs when running a shell
script in a pterm ("/dev/ttyp*"), when running make from a pterm
("/dev/ttyp*"), and when running a shell script in text mode ("/dev/con*")
How can I properly check if .kshrc is being run as a script rather than a
terminal session?
Many thanks
Neil
Neil Carter Psychology Department
IT Technician University of Wales Swansea
Wales, United Kingdom
http://psy.swansea.ac.uk/staff/Carter/
–
cburgess@qnx.com
“Colin Burgess” <cburgess@qnx.com> wrote in message
news:c3evpp$51c$1@inn.qnx.com…
I test for the interactive script flag at the beginning of my .kshrc, eg
case $- in
i)
…
esac
Thanks Colin,
I can find no mention of the interactive script flag anywhere in
HelpViewer’s ksh entry. Am I looking in the wrong place? I’d like to learn
more about it.
Cheers,
Neil
Neil Carter Psychology Department
IT Technician University of Wales Swansea
Wales, United Kingdom
http://psy.swansea.ac.uk/staff/Carter/
It’s a little hard to find, but check the “Parameters” section - this
explains that $- is a concatenation of all the ‘set’ single letter options.
University of Wales Swansea: Psychology Technicians wrote:
“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:c3evpp$51c$> 1@inn.qnx.com> …
I test for the interactive script flag at the beginning of my .kshrc, eg
case $- in
i)
…
esac
Thanks Colin,
I can find no mention of the interactive script flag anywhere in
HelpViewer’s ksh entry. Am I looking in the wrong place? I’d like to learn
more about it.
Cheers,
Neil
Neil Carter Psychology Department
IT Technician University of Wales Swansea
Wales, United Kingdom
http://psy.swansea.ac.uk/staff/Carter/
–
cburgess@qnx.com
University of Wales Swansea: Psychology Technicians <pstech@swansea.ac.uk> wrote:
“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:c3evpp$51c$> 1@inn.qnx.com> …
I test for the interactive script flag at the beginning of my .kshrc, eg
case $- in
i)
…
esac
Thanks Colin,
I can find no mention of the interactive script flag anywhere in
HelpViewer’s ksh entry. Am I looking in the wrong place? I’d like to learn
more about it.
I’ve added this stuff to the Neutrino User’s Guide (for 6.3).
Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems