Skip to main content
4 of 4
edited body
Costas
  • 15k
  • 24
  • 38

The main idea is to prepare string with the list of files to operate (even through the loop) than transfer the string to command:

sloc='/some/location'
unset flist
for i in "$@"
do
    flist[${#flist[*]}]="$sloc/$i/$i".pdf
    flist[${#flist[*]}]="$sloc/$i/$i".txt
done
scp [email protected]:"${flist[@]}" /somewhere/else/
Costas
  • 15k
  • 24
  • 38