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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.