jbsnake wrote:
bash is super intelligent... as long as you make it that way
so let's say you have a script named "uploadFile.sh"
inside that script you would have the following code...
Code:
#!/bin/bash
ls -1 "$1" > uploadList
until ! read cur_file
do
scp $cur_file
[email protected]:~/path/to/upload
done < uploadList
rm -f uploadList
with that code.. you could call the script like...
uploadFile.sh "*.jpg"
or
uploadFile.sh "file1.jpg file2.jpg file3.jpg"
or
uploadFile.sh "file1.jpg"
i think you get the idea...
the "" around the file names is only really needed if you list more than one, or there is a space in the file name

enjoy
Great, this is what I wanted to do. However this is what my newbie feathers show and I just glare with excitement not understanding a bit. Well not really, i want to figure out what you did.
So you put this line:
Code:
ls -1 "$1" > uploadList
So I assume uploadList here is a temporary file which will be populated by the "$1" which is another variable yet my first doubt is where it gets it's values from?
Then is the function itself:
Code:
until ! read cur_file
Here I am totally lost, where did the cur_file came from what does it has, is this like uploadList?
Code:
done < uploadList
Ok this line is simple, however I still dont get it, well I see that uploadList file is dumped into
done.
Still great help I will look into my BASH tutorials.