0

I am having an issue with the variable expansion. I want to read a list from a file. The list can have * or multiple file wildcard like - test* stuff*.

Here is the script

#!/bin/bash

datadirin=/home/william/tmp2
filelist=`cat $listdir/$sname.list`

export filelist
export datadirin


# echo filelist is "$filelist"
echo filelist is `cat $listdir/$sname.list`

cd $datadirin

for i in $filelist
do
echo "getting $i"
done

I want it to loop thru the list but I do not want it to read what is local, becuase i am going after files I cannot see, I am doing an ftp get.

I'm new at this and any help would be great.

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by eggi
0

Hey There, it looks like these two variables never get set:

$listdir
$sname

You'll need to assign those variables values. Since it's dynamic, it depends on how you want to do it, but maybe:

listdir=$1
nsname=$2

Not really sure what you're shooting for. You could seed $listdir with `ls`, but I don't know what you'd be looking for in a listname if you don't know what listname you're looking for.

Hope that helps :)

, Mike

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.