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: Greg Wooledge
Subject: Re: why fail , [[ $sep$*$sep == $sep--$sep ]]
Date: Sat, 17 Feb 2024 10:13:47 -0500

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?

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



reply via email to

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