I would like to ask about command in Bash and Sh. On Cshell (.csh), I have use label and command "goto" as:
#!/bin/csh -f
set a = 1
goto CHECK
CONT:
echo "${a}"
exit
CHECK:
if ( ${a} == 3 ) then
exit
else
goto CONT
endif
I make 2 label CONT
and CHECK
to separate code line.
Other example:
while (${lp_ct} < ${loop})
START_ROUND:
set count = 1
echo "===================================================="
bjobs | grep PEND | sort
echo "----------------------------------------------------"
echo "-- Round ${lp_ct}/${loop}"
set pend_s = `bjobs | grep PEND | grep -wc AL_Vcs_s`
if (${pend_s} > 4) then
echo "You are pending more than 4 license on AL_Vcs_s"
goto WAIT
endif
foreach job_pend (`bjobs | grep PEND | sort -r | awk '{print $1}'`)
bswitch AL_Vcs_s $job_pend
if (${count} == ${no_sw}) then
goto WAIT
else
@ count = ${count} + 1
goto SWITCH
endif
WAIT:
echo "-- Round ${lp_ct}/${loop} finished!"
echo "-- AL_Vcs PEND/TOTAL: `bjobs|grep PEND|grep -wc AL_Vcs`/`bjobs -u all|grep PEND|grep AL_Vcs -wc`"
echo "-- AL_Vcs_s PEND/TOTAL: `bjobs|grep PEND|grep -wc AL_Vcs_s`/`bjobs -u all|grep PEND|grep AL_Vcs_s -wc`"
@ lp_ct = ${lp_ct} + 1
goto END_ROUND
SWITCH:
end
END_ROUND:
sleep 6m
end
There are any command to do this task on Bash and Sh?
Thank you so much.