Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Unix question

Hi Guys,

I am coding a unix script .csh
my code looks like this

echo 'enter user id: '
set USERID=($<)
echo 'enter password: '
set PASSW=($<)

My question is, how can I hide the entry for password ???
And, how do you check for null values if they hit enter key without any data entered ???

Thanks for your help!!

J

Comments

  • satharielsathariel Member Posts: 59
    : Hi Guys,
    :
    : I am coding a unix script .csh
    : my code looks like this
    :
    : echo 'enter user id: '
    : set USERID=($<)
    : echo 'enter password: '
    : set PASSW=($<)
    :
    : My question is, how can I hide the entry for password ???
    : And, how do you check for null values if they hit enter key without any data entered ???
    :
    : Thanks for your help!!
    :
    : J
    :
    Hi,

    why you should use csh?? It is very buggy (a little search in the internet will prove this).
    You can hide the reply via
    [code]
    read -s PASSVAR
    echo $PASSVAR[/code]
    -s stands for silent.

    With a shell like /bin/sh or bash you can use the -z testoperator to check, if a variable has been set.
    [code]
    if [ ! -z $TESTVAR ]
    then
    echo TESTVAR is set to $TESTVAR
    else
    echo TESTVAR is not set...
    fi[/code]

    Hope i helped you finding the right way.
    [black]SaThaRiel[/black]

    [size=1][blue]Any time things appear to be going better, you have overlooked something.[/blue][/size]

Sign In or Register to comment.