Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: darwin20.6.0
Compiler: gcc
Compilation CFLAGS: -g -O2
uname output: Darwin macspear 20.6.0 Darwin Kernel Version 20.6.0: Tue Apr 19 2$
Machine Type: x86_64-apple-darwin20.6.0
Bash Version: 5.2
Patch Level: 0
Re
tions, which could
potentially leave out some function the loadable builtin expects to use.
--
Geir Hauge
diff --git a/builtins.h b/builtins.h
index 01565935..b4c71274 100644
--- a/builtins.h
+++ b/builtins.h
@@ -57,6 +57,7 @@ struct builtin {
char * const *long_doc; /* NULL terminated arra
separate arguments?
>
I don't see the usefulness in having brace expansion's behavior changed by
IFS.
If you want {1..3} to turn into the string "1;2;3", assign it to an array,
then print the array that way
array=( {1..3} )
(IFS=';'; echo "${array[*]}") # outputs "1;2;3"
printf -v var '%s;' "${array[@]}"; echo "$var" # outputs "1;2;3;"
--
Geir Hauge
;>
>
> eval "cd $var"
>
I'd avoid eval as that could potentially do more than just expand the
tilde, depending on what other characters the var contains. I'd just
replace the ~ with $HOME using parameter expansion.
cd "${var/#~\//$HOME/}"
--
Geir Hauge
2011/11/17 Dallas Clement
>
> Would appreciate any insight you could offer. Here is my script and
> the strace output for when touch returns 1.
>
Add ''set -x'' at the start of the function and examine the output to see
if it actually runs touch from PATH.
--
Geir Hauge
t file > file.tmp && mv file.tmp file
I'd welcome this >; syntax.
--
Geir Hauge
tead of
ls u
do
ls ''u
--
Geir Hauge
.)
Letting compgen do the command substitution speeds it up considerably
$ TIMEFORMAT=%R
$ time compgen -W "`seq 1 50`" 1794 >/dev/null
175.253
$ time compgen -W '`seq 1 50`' 1794 >/dev/null
2.347
--
Geir Hauge
is.
Don't use non-POSIX features in a POSIX script, and you'll be fine.
http://www.opengroup.org/onlinepubs/9699919799/utilities/contents.html
--
Geir Hauge
rather this one (ampersand
> moved before redirection):
>
> #!/bin/bash
> # TEST 2
> coproc /bin/sleep 100
> echo & >&${COPROC[1]}
This is equivalent to
echo &
>&${COPROC[1]}
& ends the command, so the redirection is not applied to the echo.
See http://wiki.bash-hackers.org/syntax/keywords/coproc
--
Geir Hauge
The code for the cut and getconf loadables under examples/loadables has
apparently been removed, but the Makefile hasn't been updated accordingly.
See attached patch.
--
Geir Hauge
removed_loadables.patch
Description: Binary data
ext release though.
http://lists.gnu.org/archive/html/bug-bash/2012-09/msg6.html
--
Geir Hauge
t; xtrace_setting=$(set -q xtrace) or something. Could we get
> something fairly straight forward for querying set/shopt state?
> Thank you for considering. Regards, Bruce
>
shopt -qo xtrace && xtrace=1
--
Geir Hauge
egfault. This also happens in bash
4.2.45 and 4.2.25, but not 3.2.48. It only segfaults when
extglob is enabled; probably because it's an incomplete extglob.
Repeat-By:
bash -O extglob -c 'help "*((*"'
--
Geir Hauge
ated into the above msgstr. So I
suggest avoiding translating the empty string.
I'm attaching patches against the latest git devel branch for the above
five typos/bugs/suggestions.
--
Geir Hauge
0001-wait-n.patch
Description: Binary data
0002-help-hash-use-PATHNAME-is-the-ful
2013/8/14 Jacek Krüger
> Bash is innacurate when testing modification dates. It ignores fractions
> of a second. Is it expected? Coreutils test does it properly.
>
Looks like that is fixed in 4.3-alpha
http://git.savannah.gnu.org/cgit/bash.git/tree/CHANGES?h=devel#n554
--
Geir Hauge
nohup sleep 10 >/dev/null 2>&1; } &
so the backgrounded process still have stdout and stderr connected to ssh.
This should do what you want:
cd /tmp && { nohup sleep 10 >/dev/null 2>&2 & }
--
Geir Hauge
uld be $'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS'.
>
> Thanks for the report. This has already been fixed for bash-4.3.
>
I reported this a while back too, and it is changed in the latest devel
branch, but it appears you introduced a different typo:
$'\nreal\t%3lR\nuser\t%3lU\nsys\tt%3lS'
--
Geir Hauge
ad'' say? perhaps you have a function or alias by that
name. I can't reproduce it either.
--
Geir Hauge
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share
anks. That patch also makes [[ -v assoc[x] ]] return 0. However,
[[ -v assoc ]] returns 1 (which it also does before the patch). Sounds
related to this bug.
--
Geir Hauge
='(x)'; declare -p array; declare
-p | grep array= \n"); }; f
bash: declare: array: not found
declare -a array='([0]="x")'
Oddly, the quotes seem to matter; changing array='(x)' to array=(x)
makes it work...
$ f() { source <(printf "declare -a array=(x); declare -p array\n"); }; f
declare -a array='([0]="x")'
--
Geir Hauge
true |
false; }'
4.3.22(1)-release
xxSegmentation fault
And lastly, in interactive mode
$ set +m; shopt -s lastpipe; trap -- "printf x" ERR; true | { true | false;
}
xxx
Can't quite understand why it would trigger the ERR trap thrice.
--
Geir Hauge
> new syntax in 4.3?
>
> (still in 4.2.43 here)...
Bash has had this feature since "forever"
$ fun='() { echo "$BASH_VERSION";}' bash1 -c fun
1.14.7(1)
Your bash 4.2.43 is no exception, but the way declare's -p and -f
options interact did change in 4.3, so try with just ''declare -f fun''
instead
--
Geir Hauge
fault; it violates
the "don't treat data as code" rule. Sure would be nice if there was a
separate flag that only disables parsing of exported functions.
--
Geir Hauge
e in addition to ~/.profile.
Assuming this is the case, I suggest you merge whatever it contains into
~/.profile, and remove the ~/.bash_profile file.
--
Geir Hauge
:
$ time bash -c '(echo "subshell \$! = $!"; wait "$!") 2> >(echo "procsub
pid = $BASHPID"; sleep 2)'
subshell $! = 74756
procsub pid = 74756
2.014
I get the same behavior with both 4.4.19 and the latest devel snapshot
--
Geir Hauge
invalid identifiers? It doesn't at present:
$ env %=% bash -c 'echo "$BASH_VERSION"; source <(declare -xp)'
4.3.30(1)-release
/dev/fd/63: line 1: declare: `%': not a valid identifier
Isn't declare -p output meant to be reusable as shell input?
--
Geir Hauge
c took 3.001 seconds
all together took: 9.004 seconds
It would be prettier if TIMEFORMAT could be set on invocation of time,
e.g. TIMEFORMAT='foo took %R seconds' time { ...; } , but time being a
keyword probably makes that hard.
One also has to be careful to sanitize any variables one embeds in
TIMEFORMAT since % characters are special.
--
Geir Hauge
lare -xf _rcs''
2. you happen to run ''set -a'' at some point before the completion
function gets dynamically loaded. When ''set -a'' is in effect, all
variables and functions you define get automatically exported. If the
output of ''echo "$-"'' contains 'a', then it is in effect.
--
Geir Hauge
bash/manual/bashref.html#Bash-Conditional-Expressions
Probably wouldn't hurt to include that in the help text for the test
builtin as well.
--
Geir Hauge
64-unknown-linux-gnu
Bash Version: 4.3
Patch Level: 33
Release Status: release
Description:
When using mapfile's callback feature, and the callback unsets the
array mapfile is appending to, it segfaults.
Repeat-By:
callback() { unset MAPFILE; }
(mapfile -c 1 -C callback <<< x)
--
Geir Hauge
but a "wow, this
> is surprising - maybe this could behave in a manner so it's not so
> surprising".
The surprising part is that it keeps the -n flag, but partially loses
the nameref ability:
$ var=foo; declare -n ref
$ ref=var
$ printf '%s - ' "$ref"; declare -p ref
foo - declare -n ref="var"
$ unset ref
$ ref=var
$ printf '%s - ' "$ref"; declare -p ref
var - declare -n ref="var"
$ ref=baz
baz - declare -n ref="var"
--
Geir Hauge
> 'var'.
> dualbus@hp:~$ unset ref; ref=var; echo "$ref"; declare -p ref
> var
> declare -n ref="var"
> dualbus@hp:~$ declare -p var
> declare -- var="var"
Ah, that explains it! Mystery solved, and no longer surprising behavior.
--
Geir Hauge
On Wed, Jul 01, 2015 at 10:19:10PM +0300, Ilya Basin wrote:
> Hi list.
>
> Want to read whole stdin into variable.
> Don't want to spawn new processes (cat).
> Don't want to reopen existing fd &0
>
> First thing I tried: $(<&0)
> It silently returns an empty string.
This type of query is prefera
it about this fun feature here:
http://www.in-ulm.de/~mascheck/various/alternate_charset/
--
Geir Hauge
On Sat, Oct 10, 2015 at 08:01:05PM -0700, Linda Walsh wrote:
> # this is odd: 2vars with content for 2:
> >unset a b
> >a= b= read a b <<< x y
> >declare -p a b
> declare -- a="x"
> declare -- b=""
>
> # -- where did "y" go?
read a b <<< x y
is the same as
read a b y <<< x
If you escap
> Any suggestions?
> >
> > Thanks!
> >
> trap '__=$_; preexec; : "$__"' DEBUG
And since the preexec function ignores its arguments, it can be
shortened to:
trap 'preexec "$_"' DEBUG
--
Geir Hauge
read -ra c <<< "HEllO woRLd"
mapfile d <<< "HEllO woRLd"
declare -p a b c d
Output:
declare -al a=([0]="hello" [1]="world")
declare -l b="hello world"
declare -al c=([0]="HEllO" [1]="woRLd")
declare -al d=([0]=$'hello world\n')
--
Geir Hauge
eferred over echo:
while read -r line; do printf '%s\n' "$line"; done < test.txt
--
Geir Hauge
hould be slightly
faster than your -eq hack.
is_digit() { [[ -n $1 && $1 != *[![:digit:]]* ]]; }
or the sh variant:
is_digit() { case $1 in ''|*[![:digit:]]*) return 1;; esac; }
See also http://mywiki.wooledge.org/BashFAQ/054
--
Geir Hauge
can pick one of these instead:
mapfile < "$file"; IFS= foo="${MAPFILE[*]}"; unset -v IFS
or
mapfile < "$file"; printf -v foo %s "${MAPFILE[@]}"
--
Geir Hauge
42 matches
Mail list logo