Re: Shell equivalent of continue|break ???



On Thu, 13 Dec 2007 01:24:51 -0800 (PST), Janis wrote:
On 13 Dez., 07:42, "lihao0...@xxxxxxxxx" <lihao0...@xxxxxxxxx> wrote:
Under GNU bash, Is there an equivalent of "continue" and "break"
statement as in C programming language. for example, in the following
snippet:

while getopts ":lsh" opt; do
case $opt in
s ) option=0 ;;
l ) option=1 ;;
h ) echo 'Usage: myscript -[ls] 23445 #long|short report'
exit 1 ;;
* ) # <--- Here I want to restart the "while" loop

As long as there are no other commands between 'esac' and 'done' you
can just put in a "true" command to continue after the esac...

* ) : ;;
[...]

You don't even need the ":".

--
Stephane
.



Relevant Pages