help-bash
[Top][All Lists]
Advanced

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

Re: why fail , [[ $sep$*$sep == $sep--$sep ]]


From: alex xmb sw ratchev
Subject: Re: why fail , [[ $sep$*$sep == $sep--$sep ]]
Date: Sat, 17 Feb 2024 16:44:34 +0100

On Sat, Feb 17, 2024, 16:37 alex xmb sw ratchev <fxmbsw7@gmail.com> wrote:

>
>
> On Sat, Feb 17, 2024, 16:14 Greg Wooledge <greg@wooledge.org> wrote:
>
>> On Sat, Feb 17, 2024 at 04:07:22PM +0100, alex xmb sw ratchev wrote:
>> > set aa bb cc -- dd ; f=$'\1' IFS=$f ; [[ $f$*$f == "$f--$f" ]] && echo
>> ye
>> >
>> > it says no ye
>>
>> Why would you think $* and -- would be equivalent, when you've got 5
>> positional parameters?
>>
>
> i used the old logic , sep sep-item-list sep matching sep data sep
>
> the -- is for arg sep , cat1.. -- cat2 -- cat3 ( or cat1 cat2 cat3 )
> it was for testing possible coding ways
>

small fix : bash script cat1.. -- cat2.. -- cat3..
or
bash script cat1 cat2 cat3 # without multi

i mean for arg parsing
i wanna support -- style multi category args , and in the args possible
kinds
1 input dir ( dir cause programs purpose )
2 '<' or '<0' for nextarg is file list , one per \n one per \0

..

unicorn:~$ set aa bb cc -- dd
>> unicorn:~$ f=$'\1' IFS=$f
>> unicorn:~$ printf %s "$*" | hd
>> 00000000  61 61 01 62 62 01 63 63  01 2d 2d 01 64 64
>> |aa.bb.cc.--.dd|
>> 0000000e
>> unicorn:~$ printf %s "$f$*$f" | hd
>> 00000000  01 61 61 01 62 62 01 63  63 01 2d 2d 01 64 64 01
>> |.aa.bb.cc.--.dd.|
>> 00000010
>> unicorn:~$ printf %s "$f--$f" | hd
>> 00000000  01 2d 2d 01                                       |.--.|
>> 00000004
>>
>
> i think in ur example would been 012d2d01
> if 2d is -
>
>>


reply via email to

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