LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to read text file using bash script (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-read-text-file-using-bash-script-625358/)

kkpal 03-03-2008 07:32 AM

how to read text file using bash script
 
hi all

I am using Xdialog. I am giving you details what i want to do.

Xdialog --title "login window" \
--3inputsbox "" 0 0 \
"Username" "" \
"Password" "" \
"phone number" "9100" 2> /tmp/tmp.txt


I am taking input from user and store in a file.
But I want to store every input in three different variable.
How can I do that?


Regards
KKPal

bigrigdriver 03-03-2008 09:56 AM

Download a copy of the Absolute Bash-scripting Guide. It should have enough instruction with examples.

Tinkster 03-03-2008 11:40 AM

Quote:

Originally Posted by kkpal (Post 3076575)
hi all

I am using Xdialog. I am giving you details what i want to do.

Xdialog --title "login window" \
--3inputsbox "" 0 0 \
"Username" "" \
"Password" "" \
"phone number" "9100" 2> /tmp/tmp.txt


I am taking input from user and store in a file.
But I want to store every input in three different variable.
How can I do that?


Regards
KKPal

Code:

name=$(cut -f1 -d/ /tmp/tmp.txt)
and so forth... you should think about a different approach to
the temporary file, though, in case more than one person were
to use the system. If the user is NOT the same person (numerical
uid) they won't be able to overwrite the file.


Cheers,
Tink


All times are GMT -5. The time now is 05:33 AM.