How to put the default value

Hi guys
Iam looking for a small help.I wrote a script. in that iam trying to take the default value ,when we press enter.this part iam struggling can somebody help please

Example:

do u need this server[dingdong.xxx.com]:

For this one if we press enter it has to take server name as dingdong.xxx.com.

Can somebody help me with this.Appreciate your help guys

--CoolKid

you can check if the variable is empty. if it is empty, set the needed value and you are done...

something like:

read var
if [ -z $var ]
then
 var=your value
fi

Nice...It works as expected thanks a lot bud

You can use the following syntax:

$ ./s
do u need this server[dingdong.xxx.com]:
server is: dingdong.xxx.com
$ ./s
do u need this server[dingdong.xxx.com]: another
server is: another
$ cat s
#! /bin/bash

read -p  "do u need this server[dingdong.xxx.com]: " server
printf "server is: ${server:=dingdong.xxx.com}\n"

For more info check the man pages of your shell,
for example:

man bash|less -p:=
     ${parameter:=word}    Assign Default Values.  If parameter is unset or
                           null, the expansion of word is assigned to parame
                           ter.  In all cases, the final value of parameter is
                           substituted.  Only variables, not positional param
                           eters or special parameters, can be assigned in
                           this way.

nice one... have to remember this!