bug-bash
[Top][All Lists]
Advanced

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

Re: Spaces in args, escapes, and command substitution


From: bash
Subject: Re: Spaces in args, escapes, and command substitution
Date: Mon, 30 Oct 2006 10:52:22 +1100

>>> $ cat x3
>>> [ -d scratch ] || mkdir scratch
>>> cd scratch
>>> touch 'a b  w' 'c d  x' 'e f  y' 'g h  z'
>>>
>>> IFS=$'\n'
>>> recho $(ls -1 *)
>>> $ ../bash-3.2/bash ./x3
>>> argv[1] = <a b  w>
>>> argv[2] = <c d  x>
>>> argv[3] = <e f  y>
>>> argv[4] = <g h  z>
>>>
>> 
>> Easier is just:
>> 
>>     ls -1 *
>> 
>> Why not give an example which effectively does "vi `grep -l PATTERN *`"?
>> Your example isn't of any use.
>
>OK, one last try.  Replace `recho' with `vi', and `ls -1' with
>`grep -l PATTERN'.  Then take a deep breath and think about what
>the output of `recho' says about how the output of the command
>substitution was split.

I took a very deep breath and did this from command line:

    IFS='\n' vi $(grep -l PATTERN *)

and guess what - it does not work!

Please try and focus on the specific problem I have given.
I know it can be difficult but give it a go.

Regards
Bahser





reply via email to

[Prev in Thread] Current Thread [Next in Thread]