Getting error message "cannot bind, not a tty"

I am trying to use bind on my embedded build and I keep getting:

cannot bind, not a tty

when running bind from either /etc/profile or any other script. The
interesting thing is if I run bind interactively in a shell it works fine,
but if I put the bind command into a script and try to run from the same
shell I get above error.

What am I doing wrong here?

Thanks
Jens

Jens H Jorgensen <jhj@remove-nospam-videk.com> wrote:

I am trying to use bind on my embedded build and I keep getting:

cannot bind, not a tty

when running bind from either /etc/profile or any other script. The
interesting thing is if I run bind interactively in a shell it works fine,
but if I put the bind command into a script and try to run from the same
shell I get above error.

What am I doing wrong here?

On your embedded system, what is handling your shell i/o, and how
do you start/attach to it?

Have you run a serial or console driver? Have you run your shell on that
device? (reopen?) Did you start with the [+session] modifier?

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

I got it to work. What I had to do was [+session] … ENV=/etc/profile sh &

It still was in certain places giving me the mentioned error but by piping
the error to /dev/null I got them eliminated. Some how /etc/profile gets
called multiple times, and it seems like the first time it still errors out
with the “cannot bind…” error, but then second time it goes through.

Is it the rule that bind cannot be called from a script?

I tried on my development system and it also error’ed out when called from a
script. Is it because you are really running a second shell when executing a
script?


Jens



“David Gibbs” <dagibbs@qnx.com> wrote in message
news:b5vvk2$knn$2@nntp.qnx.com

Jens H Jorgensen <> jhj@remove-nospam-videk.com> > wrote:
I am trying to use bind on my embedded build and I keep getting:

cannot bind, not a tty

when running bind from either /etc/profile or any other script. The
interesting thing is if I run bind interactively in a shell it works
fine,
but if I put the bind command into a script and try to run from the same
shell I get above error.

What am I doing wrong here?

On your embedded system, what is handling your shell i/o, and how
do you start/attach to it?

Have you run a serial or console driver? Have you run your shell on that
device? (reopen?) Did you start with the [+session] modifier?

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Jens H Jorgensen <jhj@remove-nospam-videk.com> wrote:

I got it to work. What I had to do was [+session] … ENV=/etc/profile sh &

It still was in certain places giving me the mentioned error but by piping
the error to /dev/null I got them eliminated. Some how /etc/profile gets
called multiple times, and it seems like the first time it still errors out
with the “cannot bind…” error, but then second time it goes through.

Is it the rule that bind cannot be called from a script?

The bind command remaps key-bindings and only has meaning for an
interactive shell, in a script you won’t have keyboard input, so
bind has no meaning and probably would fail. Many scripts have
something like:

case $- in
i)
bind
alias
alias
esac

To only do things like a “bind” in an interactive script.

Or, you can try marking the script as interactive explictly with a
“set -i” near the start.

I tried on my development system and it also error’ed out when called from a
script. Is it because you are really running a second shell when executing a
script?

Unless you start your script with “. scriptname”, you are definitely running
a new shell process to execute the script. (This is, also, why environment
variables set by a script won’t be seen by the parent.)

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.