![]() |
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 |
| 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 |
| simple for loop | ali560045 | Shell Programming and Scripting | 3 | 12-17-2007 01:39 AM |
| Simple BASH script? | JayC89 | Shell Programming and Scripting | 16 | 10-02-2007 07:23 PM |
| Bash while loop problem | Kweekwom | Shell Programming and Scripting | 5 | 07-23-2007 12:49 AM |
| simple bash script to ftp? | satnamx | Shell Programming and Scripting | 1 | 04-21-2006 11:18 AM |
| Simple Bash Script | xaphalanx | Shell Programming and Scripting | 3 | 12-21-2005 03:54 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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* |
|
||||
|
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 ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|