printing error in a bash script using awk formatting. What is the real cause?
by centguy from LinuxQuestions.org on (#554BF)
I just do not understand the output of this simple script.
What is going on?
The jid was printed correctly. But it has a wrong value in the awk line.
Quote:


What is going on?
The jid was printed correctly. But it has a wrong value in the awk line.
Quote:
[centos69]$ cat bash-nscc-vasp-phonon-use-list #!/bin/bash for jid in 0010 0011 0012 0013 do echo $jid cmd=$(echo | awk '{printf("qsub -N batch%s -o batch%s.o -e batch%04d.e nscc-vasp-phonon.pbs",'$jid','$jid','$jid')}' ) echo $cmd done [centos69]$ ./bash-nscc-vasp-phonon-use-list 0010 qsub -N batch8 -o batch8.o -e batch0008.e nscc-vasp-phonon.pbs 0011 qsub -N batch9 -o batch9.o -e batch0009.e nscc-vasp-phonon.pbs 0012 qsub -N batch10 -o batch10.o -e batch0010.e nscc-vasp-phonon.pbs 0013 qsub -N batch11 -o batch11.o -e batch0011.e nscc-vasp-phonon.pbs [centos69]$ |