[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: string escaping in bash
From: |
Alex fxmbsw7 Ratchev |
Subject: |
Re: string escaping in bash |
Date: |
Fri, 12 Mar 2021 22:47:38 +0100 |
i think i cannot succeed
the most was the v=nonexist// version
thank you
On Fri, Mar 12, 2021 at 10:41 PM Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>
wrote:
> thank you
>
> i may post a new version soon whenever i succeed it, i just gotta think
> more about it
>
> thank you again
>
> On Fri, Mar 12, 2021 at 10:37 PM Lawrence Velázquez <vq@larryv.me> wrote:
>
>> > On Mar 12, 2021, at 3:25 PM, Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>
>> wrote:
>> >
>> > this is without keep over and does the stupid non edge cases
>> > maybe you can give me better test cases ?
>> >
>> > i=-1 res=( ) list=( '\one' '\\Two' '\\\Three' '\\\\four' '\\\\\five' )
>> > right=( '\one' '\Two' '\\Three' '\\four' '\\\five' ) ; for str in
>> > "${list[@]}" ; do str=${str//\\n/$'\n'} str=${str//\\t/$'\t'}
>> > res[++i]=${str//\\\\/\\} ; printf '%d %s %s\n' $i "${res[i]}"
>> "${right[i]}"
>> > ; done
>>
>> bash-5.1$ str='\\n'
>> bash-5.1$ printf '%s' "$str" | od -A n -t a -t x1
>> \ \ n
>> 5c 5c 6e
>>
>> This should become '\n' (0x5c 0x6e).
>>
>> bash-5.1$ str=${str//\\n/$'\n'}
>> bash-5.1$ str=${str//\\t/$'\t'}
>> bash-5.1$ str=${str//\\\\/\\}
>> bash-5.1$ printf '%s' "$str" | od -A n -t a -t x1
>> \ nl
>> 5c 0a
>>
>> --
>> vq
>>
>>
- Re: string escaping in bash, (continued)
- Re: string escaping in bash, Alex fxmbsw7 Ratchev, 2021/03/12
- Re: string escaping in bash, Lawrence Velázquez, 2021/03/12
- Re: string escaping in bash, Alex fxmbsw7 Ratchev, 2021/03/12
- Re: string escaping in bash, Alex fxmbsw7 Ratchev, 2021/03/12
- Re: string escaping in bash, Alex fxmbsw7 Ratchev, 2021/03/12
- Re: string escaping in bash, Alex fxmbsw7 Ratchev, 2021/03/12
- Re: string escaping in bash, Alex fxmbsw7 Ratchev, 2021/03/12
- Re: string escaping in bash, Alex fxmbsw7 Ratchev, 2021/03/12
- Re: string escaping in bash, Lawrence Velázquez, 2021/03/12
- Re: string escaping in bash, Alex fxmbsw7 Ratchev, 2021/03/12
- Re: string escaping in bash,
Alex fxmbsw7 Ratchev <=
- Re: string escaping in bash, Pier Paolo Grassi, 2021/03/12
- Re: string escaping in bash, Alex fxmbsw7 Ratchev, 2021/03/12
- Re: string escaping in bash, Pier Paolo Grassi, 2021/03/12
Re: string escaping in bash, Eli Schwartz, 2021/03/12
Re: string escaping in bash, Koichi Murase, 2021/03/13