LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-03-2008, 07:32 AM   #1
kkpal
Member
 
Registered: Oct 2007
Posts: 101

Rep: Reputation: 15
Thumbs up 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
 
Old 03-03-2008, 09:56 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,743

Rep: Reputation: 299Reputation: 299Reputation: 299
Download a copy of the Absolute Bash-scripting Guide. It should have enough instruction with examples.
 
Old 03-03-2008, 11:40 AM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,965
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
Quote:
Originally Posted by kkpal View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read variables from a text file in Bash jakev383 Linux - General 5 12-20-2006 07:29 AM
bash script that can read lines of text palceksmuk Programming 1 12-25-2005 03:49 AM
Script to read a simple text file ravykanth Linux - Newbie 9 10-22-2003 04:15 AM
Display/Read line 'N' in a text file using script ganninu Linux - Newbie 2 10-13-2003 05:28 AM


All times are GMT -5. The time now is 09:35 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration