printf - print filenames into scripts in bash -


how print each name of file directory string , make make new scripts?

to print each file name

for in `ls new_manifest*`; echo $i; done  

but when try , print rest of string $i doesn't seem work!

for in `ls filenames*`;  printf  '#!/bin/bash  #$ -cwd  #$ -j y  #$ -s /bin/bash  #$ -pe threaded 8   $home/bin/program -vv -c $home/program.key -d $i --max 10' > $home/scripts/$i.sh; done 

also doesn't work when use echo or backslash before $i.

you need keep format of printf on same line , keep $i outside single quotes:

for in filenames*;  printf '#!/bin/bash   #$ -cwd   #$ -j y   #$ -s /bin/bash   #$ -pe threaded 8    $home/bin/program -vv -c $home/program.key -d '"$i"' --max 10\n'  done 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -