How to set a default value in an IF snippet?

Posted by kuti on Stack Overflow See other posts from Stack Overflow or by kuti
Published on 2010-05-30T01:40:39Z Indexed on 2010/05/30 1:52 UTC
Read the original article Hit count: 221

Filed under:
|

Hello,

I have the following snippet in a bash script written in Solaris 10:

printf "port(389)="
read PORT
  if [[ $PORT == "" ]]; then
     PORT=389
  fi

What I am trying to get that if the user hits the enter key, the Port should be set to 389. The snippet above does not seem to be working.

Any suggestions?

© Stack Overflow or respective owner

Related posts about bash

Related posts about solaris