ented patch to do so on the gentoo ticket.
Suggesting ways that future versions of bash 5.3 and above can do this
*without* hacks, would accomplish something. It would accomplish the
ability to migrate away from hacks and over to proper APIs.
Maybe we should focus on that.
--
Eli Schwartz
pgen is optional,
process substitution is optional, do not assume that any of this stuff
is guaranteed to exist" then so be it.
My suggestion is that all these things are declared mandatory, and users
who wish to disable support for arrays are instructed that they should
not call the shell "bash" at all, but install it as some other binary
name. Maybe "tinysh".
It would be nice if the option to disable support for compgen was
separate from the option to disable support for readline, and the
"tinysh" naming recommendation only applied to the former, not the latter.
--
Eli Schwartz
sed/grep the contents, and you still have the original
declare -p problem that you need to parse the value of the variable in
order to figure out *where* it is so you can discard and ignore it...
which is impractical without an actual shell parser.
--
Eli Schwartz
On 6/29/23 4:39 PM, Chet Ramey wrote:
> On 6/25/23 2:38 PM, Eli Schwartz wrote:
>> compgen is a useful builtin for inspecting information about the shell
>> context e.g. in scripts -- a good example of this is compgen -A function
>> or compgen -A variable.
>>
>&
inutes trying to figure out what on earth
was going on there when I couldn't even echo the return value to check
what happened.
--
Eli Schwartz
{!a@} to expand variable names does not work generically enough since
you need to specify a prefix -- ${!@} won't expand all of them).
--
Eli Schwartz
even if bash
> (or some other process) were to attempt to examine the file after an exec
> failure to generate a nicer message ... the only thing affected would be
> the error message, and if you get weird messages when attempting to run
> binaries which are changing as you're doing
+ 1] = '\0';
}
sys_error (_("%s: %s: bad interpreter"), command, interp ? interp
: "");
FREE (interp);
return (EX_NOEXEC);
}
#endif
So I wonder, if bash already in this exact case attempts to open() the
file an
On 8/19/21 12:18 PM, Léa Gris wrote:
> Le 19/08/2021 à 16:41, Eli Schwartz écrivait :
>> On 8/19/21 9:41 AM, Léa Gris wrote:
>
>
>> The error occurs, one would imagine, during the "convert string to
>> float" stage, after parsing argv or forking to bc or wh
r the reasons specified in the POSIX
description under "Application Usage").
On the other hand, printing the output of bc into a C source file and
compiling it, rather than interpreting it via strtof, would cause it to
be parsed as machine-formatted, not display-formatted, and hence
are relying on a separate feature from translation
altogether, that of re-ordered input parameters to printf, ask for that
to be added, which is currently a fatal error:
bash: printf: `$': invalid format character
and doesn't require adding a new option to printf just for the use of
translations.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
this variant behavior? What do you think
> would be a suitable name?
In the thread Greg linked, he submitted a patch back in 2009 to
implement `shopt -s safelocale`.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
cter.
>>
>
> Nothing protect against "all" 'X' or "everything", especially when
> talking
> about security. Security is best handled as a layered approach with
> different
> layers protecting against different things. There's no such thing as a
> 'Security Magic Bullet'. Just because NOTHING protects against "ALL"
> [anything] is
> not a reason to take extreme action. In fact realization that NOTHING is
> perfect
> is one of the better defenses against over-reacting in response to
> supposed security
> flaws.
Removing quotes doesn't protect against anything, it turns a tiny
minority of security flaws into inscrutable errors from printf, makes a
different tiny minority of valid use cases incorrectly error, then fails
to log either problem, abort with errors when it cannot do anything
sensible with the input, or anything else of the sort.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
;
> ---
> How can I put the output into '$v'
> *without* using a temporary file?
>
> This seems so basic, yet its eluding me.
> Could someone throw me a clue-stick?
> Tnx!
What's wrong with the obvious
v=$(jobs | wc -l)
> p.s. - a trivial util func p
er* behavior is similar to e.g. dash's behavior, or for that
matter ksh. Both print the uname output after registering it as a
backgrounded job (redirection does not get applied to the command itself).
At any rate... are you suggesting the POSIX rules require a space here
in order to dis
do you set $XDG_CONFIG_HOME before you read
bashrc, where environment variables are typically defined".
But, as Chet said, "This is not a high priority issue."
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
.txt | sort
>
> Note it prints out:
>
> @jupiterlander
> xxaxxon
> @zorg
>
> Expected:
>
> @jupiterlander
> @zorg
> xxaxxon
The "sort" utility is not part of bash, so this is the wrong mailing
list for
On 4/25/21 11:44 AM, Eli Schwartz wrote:
>> This commit to the development branch adds a default value for
>> `BASH_LOADABLES_PATH':
>>
>> https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=fb4ddc2d2b66b776e013ddadfce86270a71c323a
>>
>> S
On 4/25/21 11:41 AM, Oğuz wrote:
> 25 Nisan 2021 Pazar tarihinde Eli Schwartz yazdı:
>
>> The bash loadables available in the standard make install seem pretty
>> useful and people might actually want to use them in scripts. But
>> scripts cannot easily know *where* they
with in order to manually set this variable in the script.
Maybe it would be good to have this variable default to the path
containing the shipped loadables? Is there any particular reason this is
not already the case.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
hich -- how charming):
https://src.fedoraproject.org/rpms/which/blob/rawhide/f/which2.sh
Corresponding to the terrible advice from the GNU which manpage:
https://man.archlinux.org/man/which.1#EXAMPLE
So, it will on every `which` invocation feed the result of `alias;
declare -f` to ` | which --weird-options` and, essentially, reinvent
`type -a`.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
BSD ports
tree names of packages, which presumably ban such characters and enforce
that ban in their tooling.
It's not something one would be wise to get into the habit of doing
elsewhere, and the quotes don't hurt, so why not add them... unless,
again, we assume the intent of the scri
/5.32/core_perl/CORE/libperl.so
$ size /usr/lib/perl5/5.32/core_perl/CORE/libperl.so
textdata bss dec hex filename
3604395 77020 25352 3706767 388f8f
/usr/lib/perl5/5.32/core_perl/CORE/libperl.so
Which is indeed much larger than bash (one binary, no libbash.so,
whether
s preferred.
$ set -x --; printf ":%s:\n" "$@"
+ printf ':%s:\n'
::
$ set -x --; printf ":%s:\n" x "$@"
+ set -x --
+ printf ':%s:\n' x
:x:
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
n't control how called programs will handle / deal with a
> present, but empty parameter, which is why I thought something that
> expands to nothing in the empty case would seem ideal.
>
> Anyone else have a trivial solution for this problem?
Does "be mindblown when it worked as is to begin with" count?
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
ed at the point where parameter expansion is introduced,
> as it is the *definition* of what parameter expansion does.
I don't see what principle makes you think it should be removed from its
current location, the description of functions (which is extremely
relevant to function scoping)
er line then it completly messes the terminal up
>
> isnt it better to escape by \e ? ..
Why is it the bash script interpreter's job to escape user-supplied
strings based on how a terminal emulator chooses to *visually* display
the results?
--
Eli Schwartz
Arch Linux Bug Wrangler an
l your emails are not being sent as
responses to other emails.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
On 2/14/21 3:35 PM, Andreas Schwab wrote:
> On Feb 14 2021, Eli Schwartz wrote:
>
>> Just a running trend that esac does not get recognized without a
>> separator.
>
> $ bash -c 'case x in x) esac'
The thread title does mention $(...) as the relevant context
rd because "esac" is a keyword:
>
> $ bash -c ': $( case x in
> more> esac )'
>
> This is with an old version, 4.2.53(1).
$ bash -c ': $( case x in x)
esac ); echo $?'
0
Doesn't seem like a special power of your degenerate case. Just a
runn
en ppl overwealth me and i mostly left
I'm fairly positive we've crossed paths on #bash, numerous times. I'm
not sure when I joined, exactly, but my current logs go back about 2 years.
I know exactly what you're talking about, and you're misrepresenting it.
--
Eli Schw
x27;s evil to try writing your own text for
eval'ing, since most people doing so seem to get it wrong. But that's
neither here nor there.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
or libncursesw.
On your system it might be misdetected. On my linux distro, libtinfo
does not exist, except as an alias to libncursesw.so.6 -- but the
official Debian package for bash overrides the detection by running:
make TERMCAP_LIB="-ltinfo"
--
Eli Schwartz
Arch Linux
7; is dangerous, better use `mkstemp' or `mkdtemp'
https://lists.gnu.org/archive/html/bug-bash/2020-07/msg00128.html
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
without execute permissions.
dash: 2: program: Permission denied
zsh: permission denied: program
ksh: program: cannot execute [Permission denied]
Hardly a bug in bash, merely a difference of opinion between the OP and
the people who design shells.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
declare name=value
declare -p name
There's an obvious inference here, that declare -p only prints, does not
create/modify, and only accepts NAMEs, therefore the optional [=VALUE]
available to other modes will not be interpreted the way you seem to
think it will be, in *this* mode.
-
On 12/29/20 10:28 AM, Chet Ramey wrote:
On 12/28/20 5:30 PM, Eli Schwartz wrote:
(Though I have to wonder at these amazing AWOL commands that get
uninstalled on people all the time right in the middle of their scripts.
It's a potential security concern, though that class of vulnerabil
ed to check if their dependencies are installed.)
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
On 12/28/20 8:15 AM, Greg Wooledge wrote:
On Sun, Dec 27, 2020 at 08:02:49AM -0500, Eli Schwartz wrote:
I'm not sure I understand the question?
My interpretation is that for an async *simple* command of the
form cmd args & where cmd cannot be executed at all (due to
lack of pe
ystem? How do you
think your proposed declare -g would work? (There is already declare -g,
maybe you'd prefer declare --superglobal or something?)
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
be made for new features rather than merely
"sometimes people are extremely forgetful, we need a new language
feature that doesn't fit in well and doesn't behave consistently, so
they can be forgetful about that instead".
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted Us
ttps://git.savannah.gnu.org/cgit/bash.git/tree/doc/bashref.texi?h=devel&id=3f17ceca108d77c5e506f03c8051f0ff13a0e11c#n7525
It was also mentioned in the release notes at
https://lists.gnu.org/archive/html/bash-announce/2020-12/msg0.html
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
o mention the right variable though...
$ BASH_LOADABLES_PATH=/usr/lib/bash/
$ enable -f setpgid{,}
$ help setpgid
setpgid: setpgid pid pgrpid
invoke the setpgid(2) system call
[...]
Given the proper variable includes "_PATH", it is even self-documenting
that no, you cannot expect "1&qu
n a
backdoor. But this does not mean Bash itself is vulnerable to network
attacks...
...
In short: The IBM X-Force Exchange entry is completely incorrect and
misunderstood the packetstorm link. The entry should be withdrawn entirely.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
;> echo -- "-n foo" # -- -n foo
>
> Also well-defined.
>
> I see nothing in your report about bash disobeying POSIX, but rather
> confusion on your part about what POSIX actually requires.
bash does disobey POSIX, but not in the manner which the report specifies.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
echo does not accept options, and is not permitted to accept options
including "--".
bash does accept -n, -e, -E in violation of POSIX, unless shopt -s shopt
-s xpg_echo is set, but it doesn't implement -- and I don't really see a
justification to do so. Either enable xpg_echo
s a plaintext file from
https://git.savannah.gnu.org/cgit/bash.git/plain/doc/bash.html?h=devel
and then open it in an HTML viewer (opening the link in a browser does
not work on its own because it is Content-Type: text/plain;)
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signatu
gt;
> function name
> A word consisting solely of letters, numbers, underscores, dashes, and
> beginning with a letter or underscore. Function names are used to label
> shell
> functions.
>
--
Eli Schwartz
Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
Please read the whole article, but pay particular attention to the
section on "don't describe your problem in terms of the incorrect
diagnostic theory you've already decided is the real problem".
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
On 8/6/20 12:36 PM, k...@plushkava.net wrote:
> On 06/08/2020 17:21, Eli Schwartz wrote:
>> On 8/6/20 11:31 AM, Jason A. Donenfeld wrote:
>>> That doesn't always work:
>>>
>>> set -e
>>> while read -r line; do
>>> echo "
ur intent. Most particularly when your intent is "I want this
command to run async, but I also want it to exit the script at XXX
location if previous aysnc commands have failed". You cannot really get
around explicitly tagging the place where you want to raise errors.
Using an RNG to randomly
o amusing errexit
> pitfalls.
lol, I bet we could fix that by adding even more error handling at a
distance.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
liable.
The use of errexit is the focus of a long-running holy war. Detractors
would point out a very lengthy list of reasons why it's conceptually
broken by design. Some of those reasons are documented here (including
process substitution): http://mywiki.wooledge.org/BashFAQ/105
I recommend
On 7/31/20 11:15 AM, Chet Ramey wrote:
> On 7/31/20 11:05 AM, Eli Schwartz wrote:
>> On 7/31/20 9:24 AM, Chet Ramey wrote:
>>> On 7/31/20 4:14 AM, jazz_...@arcor.de wrote:
>>>
>>>> Bash Version: 5.0
>>>> Patch Level: 17
>>>> Release S
ast preferred.
Perhaps...
"If EDITOR is not set, bashbug attempts to locate a number of
alternative editors, including emacs, before falling back to vi."
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
> $ BLA="1\$2"; echo 'x/'$BLA'/y/'
> x/1$2/y/
>
I'm not sure what point you're trying to make here. Are you arguing that
*printing* these backslash escapes is valid behavior here, and the
reporter has merely misunderstood the shell rules?
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
place to...
[eschwartz@arch ~]$ ls \$HOME/
[eschwartz@arch ~]$ bash --norc --noprofile
bash-5.0$ ls $HOME/
Display all 163 possibilities? (y or n)
[...]
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
hen left-click the URL: the URL is
> opened in a browser,
> but only the left part appears in the address field.
>
> The OS is Linux Mint 20
bash doesn't underline urls or open them in browsers. This is performed
by the terminal emulator program. Please report this to the sup
On 7/4/20 7:54 AM, Chris Elvidge wrote:
> On 03/07/2020 11:16 pm, Eli Schwartz wrote:
>> On 7/3/20 2:00 PM, Chris Elvidge wrote:
>>> I've used 'return $((!$#))' and 'return $[!$#]' to return an error if no
>>> parameters give
$(()N))
-bash: syntax error near unexpected token `)'
$ N=0
$ echo $((!$N))
echo $((N=0N))
-bash: N=0N: value too great for base (error token is "0N")
...
From there, people can give useful advice for solving the problem. (My
preferred advice is "disable histexpand".)
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
if you know you need extended functionality. awk might be a builtin
(is, with busybox), but gawk probably isn't!
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
xternal command in GNU Bash.
And in busybox, just like "env" it runs busybox builtin applets.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
cute other
builtin applets. That's the only case I'm aware of that will not
guarantee execution of an executable from an external file -- so
shouldn't env be safe to use as such, if you know:
a) your interpreter is bash rather than /bin/sh,
b) the external disk executable "e
opped "$(type -P cat)"
Anyway, Chet didn't say it won't be changed to do what you expected;
after all, it's acknowledged as an opportunity for optimization, and
optimization is good..
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
On 6/28/20 9:49 PM, Dale R. Worley wrote:
> Eli Schwartz writes:
>> Why not just run bash -x script-name without the bash -l option and
>> without $BASH_ENV set?
>>
>> The first is implicitly true based on your stated command line. The
>> second doesn't see
e
builtins that do this sort of thing already.
No forks involved, not even one for the lifetime of the script.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
assumption is a useful data point, saying "why
not just use a function" is not. (In fact, I'd assume the $(function) is
actively a bad idea as it would prevent bash from optimizing out the
$(/usr/bin/date) fork.)
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
r stated command line. The
second doesn't seem like a high bar to set, and it's not exactly default
behavior... if you really do need $BASH_ENV can't you do the set -x at
the end of that file?
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
ion: to replace forking with redirection to fifos.
Now, you can argue that this should or should not be a goal, but it's
quite silly to conflate the goal with "your goal could be achieved by
using a function".
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
that as it may, I can trivially reproduce your error by destroying my
own $IFS
$ output="" IFS=/
$ set output
$ printf ${1:+-v $1} "%s:%s" 23 myproc
bash: printf: ` output': not a valid identifier
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
On 6/16/20 11:07 PM, bel...@web.de wrote:
> `shopt' doesn't appear to have an option for giving output re-usable as
> input (?).
`shopt -p`, surely. Or `shopt -o -p`.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
Maybe you could make the empty
> message be a comment?
>
> $ hash -l
> # hash: hash table empty
>
> That is acceptable input for bash, has the right effect when read by
> bash, is human-readable, and is capturable by redirecting stdout.
As I suggested, yes. :)
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
ge.
stderr is also a reasonably appropriate place to emit debug info or
warnings. I would consider this a warning condition...
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
usefulness of it sufficiently to make
them decide they're better off implementing error checking a different
way... and *that* is, I think, what Greg is pointing out.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
ly major difference as
it's a very common pattern for people to reuse the results of command
substitution multiple times.
Perhaps you meant to say "executes the same command process" instead of
"has the same effect"?
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
On 6/1/20 6:28 AM, Robert Elz wrote:
> Date:Sun, 31 May 2020 22:46:48 -0400
> From: Eli Schwartz
> Message-ID: <5a7df0ba-3ad1-1f35-1107-09fdd5950...@archlinux.org>
>
> While I generally agree with ...
>
> | Don't use errexit
>
ecution a command, exitcode is set to "1" but shell script does not
> exited.
You're merely the latest person to discover that this applies to you:
http://mywiki.wooledge.org/BashFAQ/105
tl;dr
Don't use errexit, it does not mean what you think it does.
--
Eli
n, process substitution, and quote removal in order
to preprocess words to then use in a conditional expression.
To improve their understanding, they must therefore read the definition
of the [[ ]] syntax. Thus, enlightenment shall be obtained.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
- wait_for: now takes a second argument, a flags word
+
+{execute_cmd,subst}.c
+ - wait_for: change all callers to add second argument to wait_for
Seems like one caller was missed. :)
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
rn syntax for " can
possibly lead to "imitate C, which is 50 years old and thus astoundingly
even less modern than the Bourne shell by an entire decade".)
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
ich only works on very new systems? What about POSIX sh scripts?
This seems like a fairly big proposal for something I'm not even seeing
a definite argument as being actually wrong.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
ubshell.
I think perhaps what the reporter did not realize is that this is the
expected behavior of a subshell.
$ command_not_found_handle; (command_not_found_handle); sddssdfcdsfsf
$$=20819 BASHPID=20819
$$=20819 BASHPID=40810
$$=20819 BASHPID=40811
i.e. $$ doesn't change, whether invoked v
It never has.
And the quick test to show that this is the case...
$ set -H
$ true `# !xxx`
bash: !xxx`: event not found
$ true ` # !xxx`
$ true `# !!`
true `# true ` # !xxx``
$
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
intf
or set -x.
Kind of a confusing way to do things, but it could get the job done.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
ened terminal:
> [yk@localhost ~]$
>
> Redirected output is thus not present as input there.
Then maybe you should be reporting a bug to gnome-terminal due to
gnome-terminal not acting as you expected and doing something with the
input which it has been given.
How is this a bash bug?
--
Eli Schwartz
A
On 2/19/20 7:46 PM, Arfrever Frehtes Taifersar Arahesis wrote:
> Eli Schwartz 2020-02-20 23:49 UTC:
>> Your examples are all (still) broken.
>
> This would affect only 10 examples from 120, so only 8.33 % of
> examples, far from all examples.
[...]
> Majority (3 of 4) of b
is not an
array, expands to
0 if name is set and null otherwise. When @ is used and the
expansion appears within double quotes, each key expands to a separate word.
```
And, as predicted, if instead of using ${!ref[@]} you use
${!varname[@]}, you get meaningful information. If you try to
eclare -a VAR2=([0]="aaa" [1]="")
I suggest next time, do your tests with a multi-element indexed array,
since it will make it obvious when your test case is incorrectly
printing only one element.
> $ echo "${VAR3@A}"
>
> $
>
> --
> Arfrever Frehtes Taifersar Arahesis
>
--
Eli Schwartz
Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
es said they
did. Bash versions prior to 4.1 do not use locale collating order for [[
either."
Try using the C locale, for example: LC_COLLATE=C
Then see what the double brackets does.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
;t, because it takes an optional key
modifier". (uniq does have -s / -f which is sort of kind of partially
approaching the same thing, but eh, doesn't really count.)
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
ot;|uniq", I
> remember that I'll remember that '-u' is a recently added 'shortcut'
> to get the same output.
What is "recent" about sort -u? I can find it listed as a mandatory
option in the POSIX 2004 manual.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
values, it would be helpful to
actually, you know, collate them.
Given your sample text range:
$ printf %s\\n ⁰ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ | sort
⁰
₀
₁
₂
₃
⁴
₄
⁵
₅
⁶
₆
⁷
₇
⁸
₈
⁹
₉
This is plainly not in byte order.
Now you need to ask yourself the question: which locale do you want to
sort according to? I used en_US
On 12/18/19 3:13 PM, Greg Wooledge wrote:
> On Wed, Dec 18, 2019 at 03:08:20PM -0500, Eli Schwartz wrote:
>> So all bash needs to do to print {Z..a} is to take Z == ASCII decimal 90
>> and a == ASCII decimal 97, then enumerate the numbers 90-97 and
>> translate them into ascii
90-97 and
translate them into ascii. No locale awareness is needed, no heuristics,
no invocation of the locale subsystem, you don't even need to hardcode
the ASCII range in source code.
And that's why bash can support enumerating a range of ASCII characters
in LC_COLLATE=C order, whe
"works with unicode data" features, I can.
> May not happen overnight, but a fix to quote meta-chars and allow all
> characters, including, _eventually_ 'null' embedded in strings, since that
> does happen in the MS world and in C++ where counts instead of zstring
caping, into an empty
string, *before* it was passed on the command line as an argv element to
the printf builtin.
Do you think that because printf is a builtin, and you didn't use
/bin/printf, that somehow means it is exempt from the usual rule of how
shells work, and gets to see its own argv
ly be
one argument to 'for', so bash can safely parse 'do' without the ;
separator.
But I think I'll still use them despite being not strictly needed, or
I'll just confuse myself once I do need them. :p I've used them for too
long by now, anyway.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
case or for command:
! case coproc do done elif else esac fi for function if in
select then until while { } time [[ ]]
So the OP has their wish. It is documented in a section of the manpage
they did not think to check.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
}; bash -c 'func'
> since the initial subshell has an advanced knowledge that there will be
> a later command joined by an and.
An initial subshell has advanced knowledge about lots of things from the
parent shell, it is deeply, worryingly dangerous to write code that
doesn't
FAQ/105
Everyone will be much happier if they just don't use set -e, and,
instead, implement actual real error handling that a) works, b) does
what they expect in their own special snowflake case.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
1 - 100 of 122 matches
Mail list logo