[TECH] BREAKING OUT OF IF-BLOCKS IN BASH
2011 March 11 | 2 commentsToday I wanted to break out of an if-block in bash.
Neither the break
nor the continue
works mean anything in an if-block, so what to do? Create a subprocess (if your code allows it):
if [ -n "${PS1}" ] ; then
(
[ -w / ] && exit
...
)
fi
(
[ -w / ] && exit
...
)
fi
EOF
Category: blog
2 Comments
From: mirabilos
2011-03-14 13:05:22 +0100
Erm… yes.
Warning: preg_match() [function.preg-match]: Unknown modifier 'h' in /home/www/blog.crash-override.net/engine/functions.php on line 439
Your comment has been submitted
From: blindcoder
2011-03-14 13:18:40 +0100
Thanks for the code example, I guess I'll use that one from now on.
The php error comes from a stray entry in my link-blacklist. Have to check where that one came from...
Post a comment
All comments are held for moderation; basic HTML formatting is accepted.