Ich möchte über Befehl in Bash und Sh fragen. Auf cShell (.csh), habe ich Gebrauch Etikett und Befehl "goto", wie:Welcher Befehl für Label on Bash und Sh
#!/bin/csh -f
set a = 1
goto CHECK
CONT:
echo "${a}"
exit
CHECK:
if (${a} == 3) then
exit
else
goto CONT
endif
Ich mache 2 Label CONT
und CHECK
Codezeile zu trennen. Ein anderes Beispiel:
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
Es gibt keinen Befehl, diese Aufgabe auf Bash und Sh zu tun?
Vielen Dank.
Siehe dies: http://StackOverflow.com/Questions/9639103/is-there-A-goto-Begründung-in-Bash – codeforester