LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-24-2009, 03:07 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
ksh: while read doesn't get to read more than one variable


Hi!

I'm working with these scripts built for bash. It happens that it can almost work perfectly on ksh, but there is a construct that doesn't do the job at all:

while read variable1 variable2 etc

The thing is that only the first variable is set. All the others are empty.

now, read by itself (no while) can set many variables read from it's stdin... and if I'm reading from a file then I can (but hate) read the file line by line (with tail -n x | head -n 1 | read variable1 variable2 etc)... but if I'm reading from stdin directly I'm stuck.

So... how can I use while read variable1 variable2 etc on ksh?

Thanks in advance!
 
Old 07-24-2009, 03:33 PM   #2
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
I just did an experiment on GNU/Linux and reading more than one variable on the while read does work. However the box where I'm having this problem is an AIX server.
 
  


Reply

Tags
bash, ksh, multiple, read, variables, while



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 variable literally CrossMAX Programming 5 02-18-2009 06:17 AM
ksh::while read line sefaklc Programming 1 08-28-2007 02:15 AM
Debian ksh doesn't read profile Shentar Linux - General 1 09-13-2005 05:29 PM
How to read a variable from a file? Andrew Benton Programming 2 12-29-2004 10:50 PM
deaclare variable automatically with while read suchi_s Programming 1 09-13-2004 08:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:22 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