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-
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
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
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
here are probably many others.
> At a guess, I would assume everything that isn't GNU/Linux or BSD.
Gnulib already provides a strftime replacement that guarantees %s, which
is handy since the next version of POSIX is considering requiring %s in
strftime().
--
Eric Blake ebl...@redhat.com
quires that
portable applications pass at most one argument to cd, such that passing
more than one argument triggers unspecified behavior. We might as well
make that behavior intuitive.
--
Eric Blake ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
On 12/07/2011 12:02 PM, Eric Blake wrote:
> Or even nicer, behave like zsh, and treat
> cd xxx yyy
> like this (written assuming extglob syntax)
> cd xxx+($' \t')yyy
Correction:
cd xxx+([$' \t'])yyy
--
Eric Blake ebl...@redhat.com+1-919-301-3266
Lib
An error occurred.
Getting a timeout or invalid file descriptor should definitely be
considered error cases that return > 1 (SIGALRM for timeout works well).
--
Eric Blake ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
ne '>;' redirection in the
same command, and both target the same end file (whether or not by the
same file name)? What happens if the command succeeds, but the rename
of the temp file to the destination fails? Are there clobber ('>|') or
append ('>>')
NGlQaVF5 | openssl base64 -d
echo OHBjcWNLNGlQaVF5 | openssl base64 -d && echo
or modify your PS1 to start with a newline request.
--
Eric Blake ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
a subshell to do what you want. Just do:
read p
set -- "$p"
to set $1, or
read p
set -- $p
to set all of $@ according to the IFS splitting of $p.
>
> So I propose we 'wreck the language' to allow me to do
> $ read @
> to set $@, same with 1, 2,.. * (almost t
n the positional parameters, use set. It's as
simple as that. What's wrong with:
read -a myarray
set -- "${myarray[@]}"
--
Eric Blake ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
, twice. Useless use of ls and sort (globbing already
gives names in sorted order, and printf as a built-in is more efficient
than ls at listing one name per line). Why not:
sort -n $(printf %s\\n ../usage-* | tail -n1) | \
tail -n $(wc -l < template) > top_usage
> cat template top_us
e' to work; there are just
too many pitfalls and buggy shell implementations with differing
interpretations to ever expect it to be useful, even if there is a
standardized documentation for how it should behave, and even if bash
has (finally) caught up to the standards.
--
Eric Blake ebl...@
i
0
Even though we called set -e twice (both in the parent and in the
subshell), the fact that the subshell exists in a context where -e is
ignored (the condition of an if statement), there is nothing we can do
in the subshell to re-enable -e.
--
Eric Blake ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
()) forms a fourth
exception to the list of commands where set -e does not cause an exit on
non-zero status. But without a standard to follow, the fact that ksh
and bash differ in behavior is a fact of life, and you shouldn't be
using non-POSIX extensions if you want your script to be portable t
1 - 100 of 654 matches
Mail list logo