![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| simple for loop | ali560045 | Shell Programming and Scripting | 3 | 12-16-2007 10:39 PM |
| Simple BASH script? | JayC89 | Shell Programming and Scripting | 16 | 10-02-2007 04:23 PM |
| Bash while loop problem | Kweekwom | Shell Programming and Scripting | 5 | 07-22-2007 09:49 PM |
| simple bash script to ftp? | satnamx | Shell Programming and Scripting | 1 | 04-21-2006 08:18 AM |
| Simple Bash Script | xaphalanx | Shell Programming and Scripting | 3 | 12-21-2005 12:54 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Simple bash for loop problem
I'm just trying to make a script that runs in command line to echo each line in a text file. Everything i found on google is telling me to do it like this but when I run it it just echos removethese.txt and thats it. Anyone know what im doing wrong?
for i in removethese.txt; do echo $i; done but if I do this for i in 1 2 3; do echo $i; done it works... essentially i need it to run a command for me and not just echo but I was testing it with an echo first and I can't get that to even run.... *sigh* |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Try this:
while read aLine do printf "\n $aLine" done < removethese.txt |
|
#3
|
|||
|
|||
|
sweet, thanks!
|
|
#4
|
||||
|
||||
|
the reason this did not work:
Code:
for i in removethese.txt; do echo $i; done Code:
for i in `cat removethese.txt`; do echo $i; done |
|
#5
|
|||
|
|||
|
Code:
n=`wc -l $1 | awk '{print $1}'`
for ((i=1;i<=$n;i++))
do
echo `head -$i $1 | tail -1`
done
or else u can peacefully use the scripts mentioned earlier |
|||
| Google The UNIX and Linux Forums |