Re: Shell equivalent of continue|break ???
- From: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
- Date: 14 Dec 2007 07:41:17 GMT
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
.
- References:
- Shell equivalent of continue|break ???
- From: lihao0129@xxxxxxxxx
- Re: Shell equivalent of continue|break ???
- From: Janis
- Shell equivalent of continue|break ???
- Prev by Date: Re: How to Write an Infinite Loop that doesn't Die when Program Dies
- Next by Date: Re: can you concat strings in shell
- Previous by thread: Re: Shell equivalent of continue|break ???
- Next by thread: Re: Shell equivalent of continue|break ???
- Index(es):
Relevant Pages
|