interactive shell detecting

I want to add some aliases, variables and < bind > commands into
$HOME/.kshrc file. In interactive shell everythink goes OK, but problem
arises in shell scripts. I put bind command into .kshrc file and when I
started shell script, I got following message:
“cannot bind, not a tty”

OK, special builtin command “set -o” gives me a current settings:
$ set -o
emacs interactive monitor stdin

And here’s a problem: how can I resolve settings from builtin command set?
When I want to handle “set -o” output, I got:
$ set -o | cat
emacs stdin
$ set -o | grep in
emacs stdin

Can anybody help me? Is there other solution? Some environment variable? I
appreciate any answer.
Thanks.

Martin Michalek <michalek@procaut.sk> wrote:

I want to add some aliases, variables and < bind > commands into
$HOME/.kshrc file. In interactive shell everythink goes OK, but problem
arises in shell scripts. I put bind command into .kshrc file and when I
started shell script, I got following message:
“cannot bind, not a tty”

From my .kshrc:

case $- in
i)
alias ls=“ls -F”

bind ^I=complete
bind ^[^?=list-file
bind ^E=list-file

esac

(Well, there are a lot more aliases in the case, but that seems to work
for me – it detects whether or not it is an interactive shell, and only
sets those things, including the bind, for an interactive shell.)

-David

QNX Training Services
dagibbs@qnx.com

Thanks for the idea.

PS: I cannot find special parameter “$-” in documentation.

David Gibbs <dagibbs@qnx.com> wrote in message
news:9g369v$l5c$5@nntp.qnx.com

Martin Michalek <> michalek@procaut.sk> > wrote:
I want to add some aliases, variables and < bind > commands into
$HOME/.kshrc file. In interactive shell everythink goes OK, but problem
arises in shell scripts. I put bind command into .kshrc file and when I
started shell script, I got following message:
“cannot bind, not a tty”

From my .kshrc:

case $- in
i)
alias ls=“ls -F”

bind ^I=complete
bind ^[^?=list-file
bind ^E=list-file

esac

(Well, there are a lot more aliases in the case, but that seems to work
for me – it detects whether or not it is an interactive shell, and only
sets those things, including the bind, for an interactive shell.)

-David

QNX Training Services
dagibbs@qnx.com

Check the documentation of the shell’s ‘set’ command. It’s a little
obscure, but it does mention that ‘-’ is a special parameter that
lists/contains the current shell “option flags”.

-Rob


“Martin Michalek” <michalek@procaut.sk> wrote in message
news:9g4bs6$hif$1@inn.qnx.com

Thanks for the idea.

PS: I cannot find special parameter “$-” in documentation.

David Gibbs <> dagibbs@qnx.com> > wrote in message
news:9g369v$l5c$> 5@nntp.qnx.com> …
Martin Michalek <> michalek@procaut.sk> > wrote:
I want to add some aliases, variables and < bind > commands into
$HOME/.kshrc file. In interactive shell everythink goes OK, but
problem
arises in shell scripts. I put bind command into .kshrc file and when
I
started shell script, I got following message:
“cannot bind, not a tty”

From my .kshrc:

case $- in
i)
alias ls=“ls -F”

bind ^I=complete
bind ^[^?=list-file
bind ^E=list-file

esac

(Well, there are a lot more aliases in the case, but that seems to work
for me – it detects whether or not it is an interactive shell, and only
sets those things, including the bind, for an interactive shell.)

-David

QNX Training Services
dagibbs@qnx.com