Re: escaping separator character in expansion
From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: 11/01/04
- Next message: David Kirkby: "Re: Effect of changes to a running script."
- Previous message: Bill Marcum: "Re: escaping separator character in expansion"
- Maybe in reply to: Bill Marcum: "Re: escaping separator character in expansion"
- Next in thread: Marco Parrone: "Re: escaping separator character in expansion"
- Reply: Marco Parrone: "Re: escaping separator character in expansion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 1 Nov 2004 06:39:17 GMT
On 2004-10-31, Marco Parrone wrote:
> Hi,
>
> is there a built-in way to selectively escape a separator character
> during expansion?
>
> For example in
>
> ARGS="-l /tmp/1 2"
>
> I would like to escape the blankspace between 1 and 2.
>
> I know that some workarounds are: to change separator character
>
> ARGS="-l,/tmp/1 2"
> (IFS=","; ls $ARGS)
>
> or to escape it myself using sed
>
> ARGS="-l /tmp/1\ 2"
> NARGS=`echo $ARGS | sed -e 's/\([^\\]\) /\1,/g' -e 's/[\\] / /g'`
> (IFS=","; ls $NARGS)
>
> but I would like to know if there is a better way.
ls "$ARGS"
> Actually I need this stuff because I've a script (checkurls) you can
> configure about how to run another script (checkurl) which you can
> configure how to run some other programs.
>
> For example now I can have
>
> checkurls --checkurl-flags="-H -D /var/lib/checkurl/marco --additions --wget-flags=--timeout=5"
>
> but I want to pass more options to wget, for example I want to pass it
>
> --timeout=5 -q
>
> so I need to pass to checkurl
>
> --wget-flags=--timeout=5 -q
>
> as a single word.
>
> Invoking it directly on the command line I can quote it as
>
> --wget-flags="--timeout=5 -q"
>
> to prevent splitting, but as I need to call it by the way of
> checkurls, I would like to make checkurls to pass it to checkurl as a
> single word, while separing normally the other words.
>
> a brief view of the code:
>
> ...
> CHECKURL_FLAGS="-H -D /var/lib/checkurl/marco --additions --wget-flags=--timeout=5"
> ...
> checkurl $CHECKURL_FLAGS $URL_SPEC_OPTS $URL
checkurl "$CHECKURL_FLAGS" "$URL_SPEC_OPTS" "$URL"
--
Chris F.A. Johnson http://cfaj.freeshell.org/shell
===================================================================
My code (if any) in this post is copyright 2004, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
- Next message: David Kirkby: "Re: Effect of changes to a running script."
- Previous message: Bill Marcum: "Re: escaping separator character in expansion"
- Maybe in reply to: Bill Marcum: "Re: escaping separator character in expansion"
- Next in thread: Marco Parrone: "Re: escaping separator character in expansion"
- Reply: Marco Parrone: "Re: escaping separator character in expansion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]