![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| rsh script with inside a for loop | trekianov | Shell Programming and Scripting | 5 | 12-06-2008 12:39 PM |
| Checking condition inside the loop | ithirak17 | Shell Programming and Scripting | 1 | 03-13-2008 08:37 AM |
| remsh inside of while loop | joettacm | UNIX for Advanced & Expert Users | 1 | 12-07-2007 12:54 PM |
| ls while read loop - internal read picking up wrong input | dkieran | Shell Programming and Scripting | 2 | 05-14-2007 03:02 PM |
| input inside while read loop | jhansrod | Shell Programming and Scripting | 3 | 08-13-2005 10:46 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||||
|
Rather than wrestling with the shell to do this - make it easy on yourself and use Perl - for example, to only print the line if the user enters a 1....
Code:
#!/usr/bin/perl
open( FOOFILE, "< foofile" );
while( <FOOFILE> ) {
print( "Enter a number: " );
chomp( $input = <STDIN> );
if ( $input == 1 ) {
print( "You entered a 1 and the line is $_" );
} else {
print( "Ooops - not a 1\n" );
}
}
close( FOOFILE );
ZB |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|