I’m trying to automate sending many jobs to a server using the qsub command. I have made a shell script which creates multiple batch scripts based on some input files, using printf. The problem is these jobs don’t run. When I open these batch scripts created from my shell script with gedit and save them without modifying them, they then work. This makes me think this is some kind of formatting issue.
Could you give me a solution to this issue?
Here’s the shell script that creates the scripts to be submitted:
#!/bin/sh
cd /home/PATH/
FILES=$(ls inpt/ | grep "centers")
i=1
declare -i i
for f in $FILES
do
printf "#!/bin/bash\ncd /home/PATH/\n./nvt inpt/%b" "$f" > run-script$i.sh
i=$i+1
done
You must set the executable bit to your scripts:
To be sure that it is not a formting problem (or any problem with
printf) you can try to useecho: