LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Read Command (https://www.linuxquestions.org/questions/linux-general-1/read-command-785785/)

balakrishnay 01-30-2010 04:14 AM

Read Command
 
Hi,

read command will consider as one word irrespective of spaces in the word for ex :-


test case will be considered as one word incase if you assign this to one variable . But as per my requirement i want distribute the words like test and another word as case. How to do this can you any one help me out in doing this .

Regards

Bala

catkin 01-30-2010 04:41 AM

I don't understand your question.

Which language are you asking about?

If shellscript, then in bash the read command allows assigning words from a line to several variables; all the remaining part of the line goes in the last variable:
Code:

c:~$ read var1 var2 var3
a b c d e f
c:~$ echo $var1
a
c:~$ echo $var2
b
c:~$ echo $var3
c d e f



All times are GMT -5. The time now is 08:56 PM.