Article 554BF printing error in a bash script using awk formatting. What is the real cause?

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:
[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]$
latest?d=yIl2AUoC8zA latest?i=_LQdq168s4c:O2Rroa8vqT0:F7zBnMy latest?i=_LQdq168s4c:O2Rroa8vqT0:V_sGLiP latest?d=qj6IDK7rITs latest?i=_LQdq168s4c:O2Rroa8vqT0:gIN9vFw_LQdq168s4c
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments