Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: coloring a substitution
- X-seq: zsh-users 28376
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: coloring a substitution
- Date: Fri, 11 Nov 2022 14:24:48 -0800
- Archived-at: <https://zsh.org/users/28376>
- In-reply-to: <CAN=4vMqjXp6SCwD9o0JwCZUbcpjAayB7zstTib88UHjQ4PqB1A@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <5454df12-02c6-75b5-e552-c486e231183c@eastlink.ca> <CAN=4vMqMsigw20xAdLGcTNmTVKWe4chtFRWLdcXdXS4zQR_Q2w@mail.gmail.com> <1b44b09a-ebae-a45d-a19d-c83e1ce68f65@eastlink.ca> <CAN=4vMqjXp6SCwD9o0JwCZUbcpjAayB7zstTib88UHjQ4PqB1A@mail.gmail.com>
On 2022-11-09 00:19, Roman Perepelitsa wrote:
Try this instead:
if [[ $scope_msg = 'BROAD' && $dirname = (#i)*$~1* ]] ||
[[ $scope_msg = 'Case INsensitive TAME' && $dirname = (#i)$~1 ]] ||
[[ $scope_msg = 'Case Sensitive WILD' && $dirname = *$~1* ]] ||
[[ $scope_msg = 'EXACT' && $dirname = $~1 ]]; then
That's in place Roman, works identically to mine and I'll keep it on
your say so, but what are the fine points on why your lines are better?
I understand the '$~' now so that's accepted. As I now have it:
NEW:
if [[ "$scope_msg" = 'BROAD' && $dirname ==
(#i)*$~1* ]] \
|| [[ "$scope_msg" = 'Case INsensitive TAME' && $dirname == (#i)$~1
]] \
|| [[ "$scope_msg" = 'Case Sensitive WILD' && $dirname ==
*$~1* ]] \
|| [[ "$scope_msg" = 'EXACT' && $dirname == $~1
]]; then ; # Do nothing, we have a match.
else cc[$aa]= # Kill the line, it does not match.
fi
OLD:
if [[ "$scope_msg" = 'BROAD' && $dirname =
(#i)*$1* ]] \
|| [[ "$scope_msg" = 'Case INsensitive TAME' && $dirname:u = $1:u ]] \
|| [[ "$scope_msg" = 'Case Sensitive WILD' && $dirname =~ $1 ]] \
|| [[ "$scope_msg" = 'EXACT' && $dirname = $1 ]];
then ; # Do nothing, we have a match.
else cc[$aa]= # Kill the line, it does not match.
fi
If this works, consider using more traditional names for these cases:
- case-insensitive partial
- case-insensitive full
- case-sensitive partial
- case-sensitive full
I'm having fun experimenting with these terms and no one but me will
ever read them so I amuse myself. I like 'exact'. 'broad' is
useless. Yeah, 'full' and 'partial' are more standard and perfectly
clear. Tx.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author