LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927
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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration