Skip to main content
edited body
Source Link
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='[email protected]:sloc='/some/location/'location'
flist=(unset $(flist
for i in "$@" ;  
do 
 printf '%s ' "$sloc$iflist[${#flist[*]}]="$sloc/$i/$i".{pdf,txt} 
 ; done ) )flist[${#flist[*]}]="$sloc/$i/$i".txt
done
scp [email protected]:"${flist[@]}" /somewhere/else/

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='[email protected]:/some/location/'
flist=( $(for i in "$@" ; do printf '%s ' "$sloc$i/$i".{pdf,txt} ; done ) )
scp "${flist[@]}" /somewhere/else/

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/
edited body
Source Link
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='[email protected]:/some/location/'
flist=( $(for i in "$@" ; do printf '"%s"'%s ' "$sloc$i/$i".{pdf,txt} ; done ) )
scp $"${flist[*]flist[@]}" /somewhere/else/

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='[email protected]:/some/location/'
flist=( $(for i in "$@" ; do printf '"%s" ' "$sloc$i/$i".{pdf,txt} ; done ) )
scp ${flist[*]} /somewhere/else/

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='[email protected]:/some/location/'
flist=( $(for i in "$@" ; do printf '%s ' "$sloc$i/$i".{pdf,txt} ; done ) )
scp "${flist[@]}" /somewhere/else/
edited body
Source Link
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='sloc='[email protected]:/some/location/'
flist=( $(for i in "$@" ; do printf '"%s" ' "$sloc$i/$i".{pdf,txt} ; done ) )
scp [email protected]:${flist[*]} /somewhere/else/

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/'
flist=( $(for i in "$@" ; do printf '"%s" ' "$sloc$i/$i".{pdf,txt} ; done ) )
scp [email protected]:${flist[*]} /somewhere/else/

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='[email protected]:/some/location/'
flist=( $(for i in "$@" ; do printf '"%s" ' "$sloc$i/$i".{pdf,txt} ; done ) )
scp ${flist[*]} /somewhere/else/
Source Link
Costas
  • 15k
  • 24
  • 38
Loading