shell scripting

I am trying to write a script in QNX and used “read” to get input to a
variable. But it does not recognize “read”.
Is there any other way to get input ?

Your suggestions are appreciated.

Shashank

Shashank <sbalijepalli@precitech.com> wrote:

I am trying to write a script in QNX and used “read” to get input to a
variable. But it does not recognize “read”.
Is there any other way to get input ?

What shell are you using? Using the standard ksh (sh) that we ship,
I am able to read input into a variable in my script using:

read var?“Are you logged in from QNX? (y/n)”.

And, what I type ends up in var.

How are you trying to do it?

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com

Thanks for the reply. I figured it out. I am a beginner at shell scripting
and have a couple more questions. I would appreciate it if someone could
gvie suggestions.

  1. How can I read without displaying on the screen? I’d like to read in a
    password and for obvious reasons wouldn’t want to display it.

    \
  2. How can I get the output of a command that I execute in my script?

Thanks,

Shashank




“David Gibbs” <dagibbs@qnx.com> wrote in message
news:ciq1vr$q5b$1@inn.qnx.com

Shashank <> sbalijepalli@precitech.com> > wrote:

I am trying to write a script in QNX and used “read” to get input to a
variable. But it does not recognize “read”.
Is there any other way to get input ?

What shell are you using? Using the standard ksh (sh) that we ship,
I am able to read input into a variable in my script using:

read var?“Are you logged in from QNX? (y/n)”.

And, what I type ends up in var.

How are you trying to do it?

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com

Shashank <sbalijepalli@precitech.com> wrote:

Thanks for the reply. I figured it out. I am a beginner at shell scripting
and have a couple more questions. I would appreciate it if someone could
gvie suggestions.

  1. How can I read without displaying on the screen? I’d like to read in a
    password and for obvious reasons wouldn’t want to display it.

Dunno. Might have to write a custom program.

  1. How can I get the output of a command that I execute in my script?

I think either $(command) or command can be used to capture the output
of a command into a variable.

You probably want to read through the ksh documentation looking for
the different commands/operands, and think about getting a book on
ksh programming (Learning the Korn Shell from O’Reilly & Associates is
one that I used.) if you’re going to do much of it.

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com

Shashank wrote:

Thanks for the reply. I figured it out. I am a beginner at shell scripting
and have a couple more questions. I would appreciate it if someone could
gvie suggestions.

  1. How can I read without displaying on the screen? I’d like to read in a
    password and for obvious reasons wouldn’t want to display it.

You could try:

stty -echo

read passwd

#stty echo

regards


Per Åkesson
Carmenta AB
SWEDEN