[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] pass command to script
From: |
Warlich, Christof |
Subject: |
Re: [Help-bash] pass command to script |
Date: |
Fri, 26 Apr 2019 08:07:55 +0000 |
A small correction to my previous post:
> Luckily, $'...' quoting comes to a rescue here:
>
> $ ls $'\'foo\''
> ls: cannot access 'foo': No such file or directory
>
> But it just adds only _one_ additional layer of nesting, so it is still easy
> to find
> examples of command lines (that already used up all possible quote-nesting by
> itself) that would not work.
I was wrong here: Infinite nesting depth _is_ possible using the $'...' syntax:
$ ls $'$\'$\\\'foo\\\'\''
ls: cannot access $'$\'foo\'': No such file or directory
> Furthermore, the backslashes really look ugly.
>
> To me, the almost prefect solution would be if bash offered some sort of
> nestable quotes right away, e.g. something like $[], which may not already
> be in use afaik. What do you think? Would this be a desirable (and decently
> easily implementable) feature for bash?
But the above lines still hold true. Even better: Something like $[]-type
quoting would eliminate the need for escaping all along! Thus, any command line
that would avoid the currently available single quoting ('...' and $'...') like
a plague in favour of some new nestable quoting like $[] would not have to
change anything within this command if another layer of (nestable) quotes would
become necessary around that whole command, e.g. for passing it to a script to
eval that string.
Cheers,
Chris
- [Help-bash] pass command to script, Warlich, Christof, 2019/04/26
- Re: [Help-bash] pass command to script,
Warlich, Christof <=
- Re: [Help-bash] pass command to script, Greg Wooledge, 2019/04/26
- Re: [Help-bash] pass command to script, Chet Ramey, 2019/04/26
- Re: [Help-bash] pass command to script, Warlich, Christof, 2019/04/26
- Re: [Help-bash] pass command to script, Chet Ramey, 2019/04/26
- Re: [Help-bash] pass command to script, Warlich, Christof, 2019/04/26
- Re: [Help-bash] pass command to script, Greg Wooledge, 2019/04/26
- Re: [Help-bash] pass command to script, Christof Warlich, 2019/04/26
- Re: [Help-bash] pass command to script, Chet Ramey, 2019/04/26
- Re: [Help-bash] pass command to script, Warlich, Christof, 2019/04/26
- Re: [Help-bash] pass command to script, Chet Ramey, 2019/04/26