* From: Roger Leigh * Date: Wed, 09 May 2007 22:48:49 +0100 > > Hi folks,
Hallo. > # Unmount all filesystem under specified location > # $1: mount base location > do_umount_all() > { > "$LIBEXEC_DIR/schroot-listmounts" -m "$1" | > while read mountloc; do > if [ "$AUTH_VERBOSITY" = "verbose" ]; then > echo "Unmounting $mountloc" > fi > umount "$mountloc" || exit 1 > done || exit 1 > } > > The problem here is that if schroot-listmounts segfaults (the trigger > in this case) or returns an error, Two things. 1) Note, that `while' runs in the sub-shell (make sure to understand this) 2) Pipe is cause of wrong assumption. Little stick -- huge impact. Thus, here it is: USENET FAQ: <http://groups.google.com/group/comp.unix.shell/browse_thread/thread/5075fe6c19ddabb9/7a08dffe06316a29?lnk=3Dst&q=3Dcomp.unix.shell+faq+pipe+status=&rnum=3D7&hl=3Den#7a08dffe06316a29> Here Bourne shell version is most convenient, don't try to use/understand POSIX shell version ;) UNIX Power Tools (47.2.1.4 More Elaborate Combinations) http://unix.org.ua/orelly/unix/upt/ch47_02.htm Compare that to historical perspective. Thus, without bashizms yet! -- -o--=O`C #oo'L O <___=E M -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]