Am Mit, 24. Okt 2001, 16:25:27 -0400 schrieb Adam Di Carlo: > Richard Hirst <[EMAIL PROTECTED]> writes: > > > smallyes '' | repeat 5 in_target_msg "unpacking required packages. This will be >attempted 5 times." dpkg --force-depends --unpack $(debfor $required) > > > > > > that msg with the spaces is protected by quotes so it appears as $1 to > > repeat(), but it isn't protected when repeat() passes it to > > in_target_msg(). I changed the string to > > > > "\"unpacking required packages. This will be attempted 5 times.\"" > > > > and that worked. Needed in the two places that use repeat 5 in_target_msg. > > Argh! Thanks for finding it. I'll fix it now. > > Can I say that shell quoting is the bane of my existance? [...]
I think a better solution would be to fix repeat() instead of every call to repeat(). The following seems to do it - I tested it in ash (0.3.8-27) an got the correct errormessages. I'm not sure if the "local i" is requiered an I don't know also if the whole thing is bashism. ---------------------------------------------------------------------- repeat () { local n="$1" shift # me start local i set -- `for i in "$@"; do echo "\"$i\""; done` # me end while [ "$n" -gt 0 ]; do if eval "$@"; then break else n="$(( $n - 1 ))" sleep 1 fi done if [ "$n" -eq 0 ]; then return 1; fi return 0 } ---------------------------------------------------------------------- Jö. -- A mathematician is a device to turn coffee into theorems.
msg12658/pgp00000.pgp
Description: PGP signature