Re: quoting pathnames with spaces
Michal Nazarewicz wrote:
> Charles Russell <SPAMworFREEwor@bellsouth.net> writes:
>
>
>>Michal Nazarewicz wrote:
>>
>>>It would be definitly more complicated then typing cp file "$WPATH".
>>>
>>
>>But I would only have to do it once. And I could use it as
>>a prototype the next time I had the problem.
>
>
> You'll have to write something like:
>
> cp file $(escape $VARIABLE)
>
> anyways and still I dunno if that would work. Or you'll have to create
> houndreads of functions like:
>
> cp_FOO () { cp -- "$1" "$FOO"; }
> mv_FOO () { mv -- "$1" "$FOO"; }
> cp_BAR () { cp -- "$1" "$BAR"; }
> mv_BAR () { mv -- "$1" "$BAR"; }
> something_baz () { something -- "$1" "$BAZ"; }
>
> I don't think it's worth it.
>
The standard Bourne shell often has simple tricks that are not apparent
to me, but in this case, I suppose there is no way to write a macro that
expands to a quoted string. If you double quote or escape in any way,
it won't expand at all.
|