Welcome to WebmasterWorld Guest from 54.167.46.29

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

bash assignment

     
9:09 pm on Jan 30, 2010 (gmt 0)

New User

5+ Year Member

joined:June 15, 2009
posts:6
votes: 0


Hi , i've been programming in bash for a week or so and have this assignment to do but i get this error message when i execute my program:

line 6: syntax error near unexpected token `do

And here's my code:

#!/bin/sh
while [ -n $1 ]
do
list= `ls $1`
for i in $list
do
cat $i >> basename $i
rm $i
done
shift 1
done

I know it's a stupid mistake but i can't figure it out.

Thanks

1:28 pm on Feb 1, 2010 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10544
votes: 8


i would add some echo statements to verify that the argument you are passing is as expected and that the list variable for example contains what you expected.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members