The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
while loop not taking the not equal to condition ssuresh1999 UNIX for Dummies Questions & Answers 9 08-12-2008 10:05 AM
put an interactive script in background after taking input epsilonaurigae Shell Programming and Scripting 7 02-15-2008 10:18 PM
need help with using input file in the while loop sytycd712 Shell Programming and Scripting 2 08-16-2007 12:11 AM
Problem with ^M in input file noelcantona Shell Programming and Scripting 2 10-24-2005 05:58 AM
TCSH.need help.take input during a while/end loop seg Shell Programming and Scripting 1 08-28-2003 04:41 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-03-2008
bash_in_my_head bash_in_my_head is offline
Registered User
  
 

Join Date: Dec 2008
Location: Southern California
Posts: 7
Problem taking input from file with for loop

I am trying to take input from a file and direct it into a bash script. This script is meant to be a foreach loop. I would like the script to process each item in the list one by one and direct the output to a file.


[root@uverse ~]# cat 1loop
#!/bin/bash
# this 2>&1 to redirect STDERR & STDOUT to file
LIST=$1
for i in "$LIST"; do
ping -c 2 "$LIST"; &> /root/error_mess
done

I have a file called ipaddresses with one ip per line.
This script works if I supply one ip after the script name upon execution, but not like this
#./1loop < ipaddresses
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:35 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0