[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dchroot scripts



I love replying to myself.

There's actually a problem with quote-args as I presented it:
specifying no arguments would result in one quoted argument, which
will seriously break lots of commands.  Here's a better version:

quote-args
----------
#! /bin/sh

if [ $# != 0 ]; then
        echo -n "`echo "$1" | quote-sh`"
        shift
        for A in "$@"; do
                echo -n " `echo "$A" | quote-sh`"
        done
fi
echo


Kyle Rose <krose@krose.org> writes:

> quote-args
> ----------
> #! /bin/sh
>
> QUOTED=`echo "$1" | quote-sh`
> shift
> for A in "$@"; do
>         QUOTED="${QUOTED} `echo "$A" | quote-sh`"
> done
> echo "$QUOTED"



Reply to: