Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: cygwin
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='cygwin' -DCONF_MACHTYPE='i686-pc-cygwin' -DCONF_VENDOR='pc'
-DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -
rawback of not having these in the repo and not in .gitignore
>> is that a 'git status' complains about untracked files.
>
> OK, this is a good reason.
But even if the upstream repo doesn't want to ignore a file in the
(checked-in) .gitignore, you can always edit your (local-
Hey,
When doing an assignment with an uneven number of elements bash currently
silently treat the last element
as a key and assigns it an empty string.
$ typeset -A ary=(this feature came from zsh); typeset -p ary
declare -A ary=([came]="from" [this]="feature" [zsh]="" )
In zsh this is an erro
On 3/28/21 12:25 AM, Oğuz wrote:
Why? I think it's better this way.
--
Oğuz
1) For consistency sake with the shell the idea was borrowed from mostly.
2) Prior to this extension bash required specifying the key and value for
AA assignments, so it seems weird to silently ignore that a value w
On 3/28/21 7:02 AM, Oğuz wrote:
As it should be. `[bar]' doesn't qualify as an assignment without an equals
sign, the shell thinks you're mixing two forms of associative array assignment
there.
In the new form, that a key is listed inside a compound assignment alone
implies that it was meant
On 3/29/21 5:18 PM, Chet Ramey wrote:
If you look at
a=( k1 v1 k2 v2 k3 v3)
as more or less syntactic sugar for
a=( [k1]=v1 [k2]=v2 [k3]=v3 )
it's reasonable that
a=( k1 v1 k2 )
is equivalent to
a=( [k1]=v1 [k2]= ). And that's what bash does.
Its just when populating that array dynamic
On 3/30/21 10:54 AM, Chet Ramey wrote:
> On 3/29/21 6:40 PM, Eric Cook wrote:
>> Its just when populating that array dynamically with another array
>> if that second array didn't contain `v1' hypothetically, the array gets
>> shifted to
>
> OK, how would you
On 3/30/21 3:44 PM, Chet Ramey wrote:
Is this a serious piece of code, or just one to demonstrate a programming
error?
The latter
There is only one field, terminated by `|', which becomes one array
element. This is where you `lose' the null elements, not when you attempt
to copy. Nothing you d
x55d3099d69d0 /*
72 vars */) = 0
/home/eblake
[pid 1248831] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1248831,
si_uid=14986, si_status=0, si_utime=0, si_stime=0} ---
+++ exited with 0 +++
According to POSIX, perl should REALLY be passing a "--" argument
between "-c" and the scalar string given by the user; see
https://www.austingroupbugs.net/view.php?id=1440
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
From: Eric Li
To: bug-bash@gnu.org
Subject: Integer overflow of i in string_extract_verbatim
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -Og
uname output: Linux fedora 6.2.12-200.fc37.x86_64 #1 SMP
ynonym for %b is
probably going to be easier (less shell escaping needed). Is there
any interest in a patch to coreutils or bash that would add such a
synonym, to make it easier to leave that functionality in place for
POSIX Issue 9 even when %b is repurposed to align with C2x?
--
Eric Blake, Pr
On Thu, Aug 31, 2023 at 03:10:58PM -0400, Chet Ramey wrote:
> On 8/31/23 11:35 AM, Eric Blake wrote:
> > In today's Austin Group call, we discussed the fact that printf(1) has
> > mandated behavior for %b (escape sequence processing similar to XSI
> > echo) that will even
On Thu, Aug 31, 2023 at 04:01:17PM -0500, Rob Landley wrote:
> On 8/31/23 13:31, Eric Blake wrote:
> > POSIX Issue 8 will be obsoleting %b (escape sequence interpolation) so
> > that future Issue 9 can change to having %b (binary literal output)
> > that aligns with C2x.
>
On Fri, Sep 01, 2023 at 08:59:19AM +0100, Stephane Chazelas wrote:
> 2023-08-31 15:02:22 -0500, Eric Blake via austin-group-l at The Open Group:
> [...]
> > The current POSIX says that %b was added so that on a non-XSI
> > system, you could do:
> >
> >
g that if
implementations are willing to implement it now, it will make Issue 9
easier to reason about.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
to mean "interpret my format string according
to C23 semantics" is also a viable idea, but one not mentioned in the
current incantation of the Austin Group bug. But that's why the bug
has a 30-day review period, to collect feedback comments on how it can
be better worded before Issue 8 is finalized.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
r than what existing practice has. Coreutils is
willing to do it, but I have not actually committed that patch yet,
waiting to see how this thread pans out.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
er (useful) conversion specifier in C. And given that, I prefer
naming such an extension option -C or -c (implying C-like), rather
than your suggestion of -b (implying binary, but where the implication
only benefits %b) as a better option name for such a printf extension
option.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
On Thu, Sep 07, 2023 at 02:42:16PM +0700, Robert Elz wrote:
> Date:Wed, 6 Sep 2023 11:32:32 -0500
> From: Eric Blake
> Message-ID:
>
>
> | You (anyone reading this, not just kre) are welcome to join tomorrow's
> | Austin Group meetin
On Fri, Nov 10, 2023 at 01:22:54PM -0500, Greg Wooledge wrote:
> It most definitely is *not* everywhere. It's part of GNU coreutils,
> and is generally not present on any system that does't use those (BSDs
> and commercial Unixes for example).
>From _seq(1)_ on FreeBSD:
> The seq command first a
65 MiB/s, done.
Resolving deltas: 100% (36225/36225), done.
$ cd bash/doc/
doc$ fgrep -r pretty
texinfo.tex:% above. But it's pretty close.
texinfo.tex: % and a tt hyphen is pretty tiny. @code also disables ?` !`.
doc$
Eric
Hi, I noticed bash struggles with gigantic completion lists
(100k items of ~70 chars each)
It's reproducible with both LANG+LC_ALL set to en_US.UTF-8 and C,
so it's not just locales slowing things down.
This happens on the up-to-date `devel' branch
(commit 584a2b4c9e11bd713030916d9d832602891733d7
"Dale R. Worley" wrote:
> A priori, it isn't surprising. But the question becomes "What
> algorithmic improvement to bash would make this work faster?" and then
> "Who will write this code?"
I'll try to take a look at it in a few months if I run out of
things to do and nobody beats me to it. I'
es not shadow a declaration of a, so
references to $a within f2 refer to the global variable. The local
variable a of f1 can only be accessed within f1; the behavior of f2 is
the same no matter how it was reached.
In dynamic scoping, function f2 looks up its call stack for the closest
enclosing sc
current flags and set/clear just
>> the FD_CLOEXEC bit ?
>
> I suppose it would matter if there are systems that have more than one
> flag value.
In practice, there aren't any such systems; but POSIX warns that current
practice is no indicator of future systems, and that read
ly know what the implementation's default bit
state is, and blindly setting all other bits to zero is very possibly a
bug, and easy enough to avoid by using the full R/M/W.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
On 12/02/2010 04:04 AM, Clark J. Wang wrote:
> Following command also prints nothing, confused :(
>
> for ((i = 0; i < 10; ++i)); do echo -n " $i"; done | while read v; do echo
> $v; done
http://www.faqs.org/faqs/unix-faq/shell/bash/
FAQ E4.
--
Eric Blake ebl...@redh
be a
standard-compliant script that relied on such an extension. You're
better off supplying the trailing newline, and guaranteeing a compliant
usage.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
mportant? If yes, what is the idea/concept behind
> this behavior?
Yes the order is important, and the idea behind the behavior is that
left-to-right evaluation order can be easily documented and relied on.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization libr
report means that we need to
tweak the wording of bug 249 (adding $'') to deal with the case of an
octal escape where three octal digits do not fit in 8 bits (either by
explicitly declaring it unspecified, as is the case with \x escapes; or
by requiring implementation-defined behavior, as in C99; or by requiring
explicit end-of-escape after two digits, as in Java).
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
the extra arguments are silently ignored.
I would really love it if bash copied the zsh behavior here:
cd a b
tries to find a directory matching the extglob
a+([$' \t'])b
and fails if there are multiple matches or no matches. Certainly less
typing than remembering to quote
e as for 'expr' which is standardized by POSIX to have the
same behavior.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
ember, non-zero status is NOT always 'failure'; it is the
documentation of each command that will tell you which status values
imply failure.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
of ! and ~.
>
> But in the book "C a reference manual" (Harbison & Steele), the four
> operators + - ! ~ have the same precedence.
The unary operators + and - have the same precedence as the unary ! and
~; and that level of precedence is higher than that of the binary + and -
h value 0, and status 2 and above are
reserved for errors. This was just brought up on the list earlier this
month:
http://lists.gnu.org/archive/html/bug-bash/2010-12/msg00087.html
and seems to be a recurring question:
http://lists.gnu.org/archive/html/bug-bash/2010-07/msg00121.html
--
Eric Blak
ire
bash to return failure in this case, but neither does it require bash to
return success. You should not rely on the behavior of read when the
input does not end in a newline.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
si
On 12/27/2010 10:59 AM, Stephane CHAZELAS wrote:
> 2010-12-27, 09:43(-07), Eric Blake:
> [...]
>> On 12/26/2010 01:29 PM, Stephane CHAZELAS wrote:
>>> Bash behavior is the same as every other shell, is as documented
>>> and as specified by POSIX.
>>
>>
ook in because the left-hand side of a
path name is hidden by a command substitution, but I'd rather live with
that safety than have arbitrary commands running during completion.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
hell
exits, the extent of the reaction for getopts and read will probably
have to allow both behaviors).
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
a non-interactive shell on an assignment error (POSIX
XBD 2.8.1 Consequences of Shell Errors). Even worse, neither ksh nor
bash exit the shell on 'readonly foo; unset foo; echo $?', so ksh's
behavior on 'getopts' seems like a ksh bug.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
writes a command line with the expansion of $var
rather than keeping literal $var in place, then you cannot alter $var in
between repetitions of a command - even if completion had to temporarily
expand $var in order to form better context about what I was completing
after the point that $var appeared in m
On 01/04/2011 08:05 AM, Eric Blake wrote:
> I couldn't find anything either - the POSIX wording for readonly only
> mentions assignment and unset as requiring errors. I think that's an
> unintentional hole in POSIX, though, so I'm going ahead and submitting a
> bug r
esn't help the fact that we have
to still use fork() for subshells, but as the bash binary grows larger,
posix_spawn() becomes more of a win over fork() by reducing kernel
overhead spent in marking a larger memory footprint as copy-on-write,
when that work is later discarded by an exec().
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
, *error_trap, *return_trap;
#if defined (ARRAY_VARS)
SHELL_VAR *funcname_v, *nfv, *bash_source_v, *bash_lineno_v;
- ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
+ ARRAY *funcname_a, *volatile bash_source_a, *volatile bash_lineno_a;
#endif
FUNCTION_DEF *shell_fn;
char *sfile, *t;
--
like the / character in
> single-quoted strings.
Looks like a bug in how bash was modified for trying to obey this new
POSIX rule:
http://austingroupbugs.net/view.php?id=221
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
before the official release.
However, I do agree with your sentiment that if the daily repository
were more open to the public, that it would allow for a wider set of
contributions from other developers.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://l
ations. The Austin Group would favor the ability to
create a local read-write variable that shadows a global read-only
variable, which would entail a change to this bash behavior.
[Which reminds me - I still have the action item to propose wording for
getting typeset into the next revision of POSIX]
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
not a security risk, but overriding dynamically scoped variables is
asking for problems. I agree with bash's current implementation
restrictions, given its current scoping rules.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
On 02/17/2011 08:18 PM, Chet Ramey wrote:
> On 2/17/11 10:12 PM, Eric Blake wrote:
>> On 02/17/2011 07:48 PM, Chet Ramey wrote:
>>> Consider a quick, contrived example: an administrator writes a shell
>>> package (library, set of functions, whatever) that includes, amon
09, all others are Ok...
08 is an invalid octal number. Try forcing decimal instead:
$[$(date --date='this week' +'10#%V')%2]
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
-in feature in bash? Or I have to rely on some
> external program such as perl to test the pattern matching?
case $x in abc*) ... ;; esac
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
ck me in to a single
expansion during tab completion.)
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
s like SIGHUP cleanup is to
have the signal handler record that an exception occurred, then have the
main processing loop checking that variable frequently enough to do
cleanup in a reasonable time-frame (possibly by using a pipe-to-self if
the main loop is waiting on select()), where the main loop t
ts
an invalid expression, and should not be confused with $?==1 meaning a
valid but false expression. Similarly to expr(1) returning 0 and 1
depending on value for success, and > 1 on failure.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
rm -f /tmp/$$.html
Instead of passing Safari the name of a temporary file, why not pass it
the name of a temporary pipe? Does this work any better:
[ "$DISPLAY" ] && open <(cat /tmp/x.html)
at which point there's no temporary file to remove.
--
Eric Blake e
as part of starting up bash-completion.
The answer you sort of wanted:
Yes, it would be nice to patch to bash's completion routines to add an
opt-in ability to check for programmed completion associated with
whatever the alias expanded to, and use that when there is no completion
already asso
tml#tag_18_06_02
"The parameter name or symbol can be enclosed in braces, which are
optional except for positional parameters with more than one digit or
when parameter is followed by a character that could be interpreted as
part of the name."
And worth documenting as a portability pit
he empty
string, and in place of a name, we use the single-character symbol 1
instead, such that this MUST be parsed as ${1}0, not as ${10}.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
what behavior.
Yes, it would really be nice if all four of bash, gawk, sed, and grep
could agree on the same interpretation of non-C range semantics, and
implement that regardless of the underlying libc behavior. But what
semantics should we settle on?
It's an age-old problem, with no nice so
%q ' "${a[@]}"
aaa '' bbb\ \ ccc
> I'd love to see an elegant solution. :-)
OK, so printf %q prefers '' and \ over "", but the end result is an
unambiguous array listing that can be fed back into shell code.
--
Eric Blake ebl...@redhat.com
.html
Along with an accidental announcement for a missing patch 11:
http://lists.gnu.org/archive/html/bug-bash/2011-05/msg00028.html
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
nly
1.1
which means that both the case statement was aborted, and $? was impacted.
dash printed:
dash: arithmetic expression: expecting primary: "x++"
1.2
so it was like ksh other than choice of error status.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization li
the even simpler:
$ bash -c 'readonly x=5; echo $((x=5))'; echo $?
bash: x: readonly variable
5
0
$
Other shells abort rather than running echo:
$ ksh -c 'readonly x=5; echo $((x=5))'; echo $?
ksh: line 1: x: is read only
1
$ zsh -c 'readonly x=5; echo $((x=5))'; echo $
t
shouldn't really be a problem in practice in converting from one
encoding type to another.
> That said, it was my impression that a wchar was 16-bits (at least it
> is on MS. Is it different under POSIX?
POSIX allows 16-bit wchar_t, but if you have a 16-bit wchar_t, you
cannot
of [[:upper:]], the _only_ portable ways to
guarantee that you are getting just that subset are to use the C locale
or to spell out the range yourself.
In short, ranges are non-portable in all other locales.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library
warn about suspicious but usable constructs, at
least when --posix is not in effect.
$ bash -c 'echo $+'
$+
$ bash -cn '$+'; echo $?
0
$ ksh -cn '$+'; echo $?
ksh: warning: line 1: $ not preceded by \
0
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
ot;
> in bracket expressions entirely.
Which is effectively what POSIX did by stating that range expressions
outside of the C locale have unspecified effects.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
SIX folks can't even seem to get it
right; the definition of 'set -e' had to be amended even after POSIX
2008 to match historical practice, which in turn disagreed with bash
practice at the time.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
ould be highly appreciated.
set -e seldom does exactly what you want - even the writers of POSIX
2008 got it wrong, and here's how they corrected it:
http://austingroupbugs.net/view.php?id=52
and that's what bash 4.1 implemented.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
ings then VER1 < VER2 implies filevercmp (PREFIX VER1 SUFFIX,
PREFIX VER2 SUFFIX) < 0.
This function is intended to be a replacement for strverscmp. */
However, I don't see any reason to add extensions to coreutils' test
unless we have some agreement that we plan to add the sam
n relying on the decision of libc on
whether stdin defaults to fully-buffered or line-buffered.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
o
foo.
$
Coreutils' printf shares this misfortune. Sadly, it might even be a bug
in the underlying glibc printf(), although I haven't tried to write a
test program to check that, yet.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
e semantics. Here, the assignment to foo is a
different statement than the expansion of of ${!foo}. And while ${!foo}
is a bash extension, it still proves that this is a case where foo was
assigned prior to its use.
Weird...
Not if you think about it properly.
--
Eric Blake ebl...@r
separated list of locale names. The attentive
reader will realize that this is the way we manage to implement one of
our additional demands above: we want to be able to specify an ordered
list of language.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
fix a simple spelling
error for en, then all translation files have to be modified.
Yes, but gettext provides tools to make that modification easy.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
8/msg00012.html
has your unfortunate "address@hidden", the same message is easier to
understand here:
http://thread.gmane.org/gmane.comp.shells.bash.bugs/16780/focus=16890
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
return: 1: Illegal number: --
$ dash -c 'f() { return -1; }; f; echo $?'
return: 1: Illegal number: -1
$ ksh -c 'f() { return -- -1; }; f; echo $?'
255
$ ksh -c 'f() { return -1; }; f; echo $?'
255
$
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
On 08/07/2011 02:35 PM, Linda Walsh wrote:
Eric Blake wrote:
On 08/05/2011 05:41 PM, Linda Walsh wrote:
Seem to fail on any negative number, but 'exit status' is defined
as a short int -- not an unsigned value (i.e. -1 would return 255).
In bash, 'return -- -1' sets
On 08/08/2011 08:14 PM, Chet Ramey wrote:
On 8/8/11 9:42 PM, Mike Frysinger wrote:
On Monday, August 08, 2011 21:20:29 Chet Ramey wrote:
On 8/8/11 8:53 AM, Eric Blake wrote:
However, you are on to something - since bash allows 'exit -1' as an
extension, it should similarly allow
ripts in an enironment of constant change?
By sticking to the common denominator that is known to work.
Please people, am I being 'over-reactive'? Or are these valid
concerns?
At least in my view, you are coming across as over-reactive and ranting,
even if that was not your intent.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
crosoft or any other vendor.
If you want to use 'set -e', then you have to deal with arithmetic
results of 0 setting $? to 1, whether the arithmetic results come from
traditional 'expr' or extension '(())'. That's life with 'set -e'; my
advice has al
f arithmetic expansion. Also POSIX, and slightly
shorter than
: $((a=0))
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
parsed with the pre-command expansion (ie. no alias).
Yet another reasons why aliases are mostly replaced by functions.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
ember that arguments may contain spaces&c)
a() { b "$@"; }
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
, remember the difference between $* and
$@ inside "" - the former creates only one word, and only the latter
splits the result into the same number of words as were originally
arguments to the function. You meant:
f(){ for a; do echo "$a"; done; }
or
f(){ for a in "
On 08/18/2011 08:44 AM, Eric Blake wrote:
how do I write a function that would print the same as
$ \ls | cat
Useless use of cat. This can be done with \ls -1.
f(){ for a in "$@"; do echo "$a"; done; }
Or skip the loop altogether:
f(){ printf %s\\n "%@
s this a bug? Is there a workaround? Am I doing something wrong?
Merely that you were expecting -f to mean 'file and not symlink' rather
than what was documented of 'file or symlink to file'.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
On 08/18/2011 11:38 AM, Stefano Lattarini wrote:
Hi Eric.
On Thursday 18 August 2011, Eric Blake wrote:
On 08/18/2011 08:44 AM, Eric Blake wrote:
how do I write a function that would print the same as
$ \ls | cat
Useless use of cat. This can be done with \ls -1.
f(){ for a in "$@
s not
treat the \ as an escape but as a literal character, stylistically, I
prefer writing "\\n" or '\n' to make it clear that I intended a literal
backslash.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
. [[
is a bash (and ksh) extension that is part of the shell syntax (similar
to how () for subshells is part of the syntax), thus it knows how many
words, _pre-expansion_, were present, and the fact that $bla was
unquoted is not a problem, [[ -f $bla ]] is a safe way to check if $bla
is a file e
rule is counterintuitive, which is why the
default bash behavior is opposite the posix behavior).
Your question is not cygwin-specific.
is this the expected behavior?
Yes.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
On 08/24/2011 10:07 AM, Sam Steingold wrote:
* Eric Blake [2011-08-24 09:31:45 -0600]:
f(){ echo a=$a b=$b c=$c ; }
f
a= b= c=
a=a b=b f
a=a b=b c=
f
a=a b=b c=
Which is indeed correct under the rules for POSIX
This sucks big time.
Such is life when dealing with shell portability.
So
sh globally respects // on all
platforms even where it is not special.
I found this in all version of the bash.
Excuse me , if it is not a bug.
Not a bug.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
uest that it ignore CR (your explicit
request is what allows bash to ignore POSIX). Read the cygwin bash
release notes for more details on the measures you can take:
http://sourceware.org/ml/cygwin-announce/2011-02/msg00027.html
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
filename.
It's still possible to write to a file named '1':
foo >&./1
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
. "bash -x -W noprofile -W norc" should also work.
Bash currently doesn't use getopt_long for option parsing, but rolls its
own parser. A patch to make the bash parser support mixed long and
short options would also be welcome in my mind.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
is not seen in env in /path/programtorun.sh (called from cron).
Right - bash maintains two sets of variables, and only the exported ones
are visible to children.
--
Eric Blake ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org
is provides a measurable speedup, I don't know. Benchmark
it yourself if you are interested in trying it.
Meanwhile, per POSIX, bash DOES provide hashing once it learns where an
executable lives, so that future invocations can rely on the hash (the
hash is invalidated when you assign to $PATH).
> replace the ~ with $HOME using parameter expansion.
>
> cd "${var/#~\//$HOME/}"
Except that your proposed parameter expansion only works for plain ~.
It doesn't cover more useful tilde expansions, such as ~user/, which
does NOT expand to $HOME, but to "user"&
7;set -e' is almost always the wrong thing in a complex script.
--
Eric Blake ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
1 - 100 of 698 matches
Mail list logo