Unix

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Unix

Bidyut Saha
Hello sir,
I am facing some problems.
PROBLEM 1 :
When i am using read command to input any string
then it automatically removing more than one constitutive space ( white space ). how to stop this and read all white space also?

PROBLEM 2:
Suppose I am writing a script which contains a case statement.
Valid choice are + - / % and * .then how will i define invalid choice ( * in case statement )?
Please reply
Reply | Threaded
Open this post in threaded view
|

Re: Unix

Guru
Administrator
To get the spaces as is, you should quote the variable:

$ read x
hi            ab
$ echo $x
hi ab
$ echo "$x"
hi            ab


NOTE:
1. Please do not post multiple questions under the same topic.
2. Please give a meaningful title to the post so that it will help others.