Re: invoke tilde expansion on quoted string

2011-11-14 Thread Freddy Vulto
/%\/*}/'${!1#*/}' else # No, $1 doesn't contain slash eval $1=${!1} fi fi } # __expand_tilde_by_ref() ---8--- Freddy Vulto http://fvue.nl

Re: Stumped on a question of scoping and unset.

2011-05-26 Thread Freddy Vulto
) #| | | +- unset thrice to global #| | +- unset twice till global #| +- unset once till t1 #+- unset not See also: http://fvue.nl/wiki/Bash:_Unset Freddy Vulto http://fvue.nl

Re: Stumped on a question of scoping and unset.

2011-05-26 Thread Freddy Vulto
: $ typeset 'ls -l' bash: typeset: `ls -l': not a valid identifier $ echo $? 1 Freddy Vulto http://fvue.nl

Bash prefixes

2010-06-18 Thread Freddy Vulto
regarding prefixing? Does bash officially reserve any variable/function prefix to itself? At least BASH_* and COMP_* seem to be used by bash. Greetings, Freddy Vulto http://fvue.nl

Re: cd multiple levels up?

2010-06-13 Thread Freddy Vulto
information and download, see: http://fvue.nl/wiki/Bash:_Cdots Freddy Vulto http://fvue.nl

Re: Passing variables by reference conflicts with local

2010-05-05 Thread Freddy Vulto
#| +- unset once till t1 #+- unset not It seems to work on bash-3.0, 3.2, 4.0 and 4.1. Is this a bug or a feature? Freddy Vulto http://fvue.nl/wiki/Bash:_passing_variables_by_reference

Re: Passing variables by reference conflicts with local

2010-05-05 Thread Freddy Vulto
safe because the varname is checked by `unset'? So now we can stop condemning people who're passing variables by reference and write even more beautiful bash code! ... ...until we find another caveat ;-) am I overlooking something? Freddy Vulto http://fvue.nl/wiki/Bash

Re: Passing variables by reference conflicts with local

2010-05-02 Thread Freddy Vulto
blackbox i __2 __3 # Outputs error d='ls /;true'; blackbox i $d $d # No oops _blackbox a # Force public access Freddy Vulto http://fvue.nl/wiki/Bash:_passing_variables_by_reference

Re: Passing variables by reference conflicts with local

2010-05-01 Thread Freddy Vulto
On 100430 08:19, Greg Wooledge wrote: On Fri, Apr 30, 2010 at 12:02:58AM +0200, Freddy Vulto wrote: Passing variables by reference however, has a caveat in that local variables override the passing by reference, e.g.: t() { local a eval $1=b } unset

Re: Passing variables by reference conflicts with local

2010-05-01 Thread Freddy Vulto
# Outputs error d='ls /;true'; blackbox $d # No more oops Freddy Vulto http://fvue.nl/wiki/Bash:_passing_variables_by_reference

Re: Passing variables by reference conflicts with local

2010-05-01 Thread Freddy Vulto
a # Force public access Freddy Vulto http://fvue.nl/wiki/Bash:_passing_variables_by_reference

Passing variables by reference conflicts with local

2010-04-29 Thread Freddy Vulto
causes a conflict: $ t __1; echo $__1 ERROR: variable name conflicts with local variable: __1 $ t a; echo $a b Thoughts? Ideas? Is there a bash-builtin to detect conflicts? If not, wouldn't it be an idea to add such a builtin? Freddy Vulto http://fvue.nl/wiki/Bash

echo ^C

2010-02-23 Thread Freddy Vulto
then typing ^C, just like bash-4? Regards, Freddy Vulto http://fvue.nl

compgen -f failing on directory containing single quote

2009-12-13 Thread Freddy Vulto
`compgen -f' produces no output if the directory contains a single quote. I get the same result on both bash-3.2.39 and bash-4.0.35. Steps to reproduce the problem: $ mkdir a\'b $ touch a\'b/{c,d} $ compgen -f a\'b/ $ Expected output: a\'b/c a\'b/d Freddy Vulto http

Re: compgen -f failing on directory containing single quote

2009-12-13 Thread Freddy Vulto
... It seems compgen is leaving out the quote out erroneously: $ mkdir a\'b $ touch a\'b/c $ mkdir ab $ touch ab/e $ compgen -f a\'b/ ab/e # Should be a\'b/c Freddy Vulto http://fvue.nl

Re: compgen -f failing on directory containing single quote

2009-12-13 Thread Freddy Vulto
$ compgen -f a\\\'b/ # Workaround for bash-3 a\'b/c Regards, Freddy Vulto http://fvue.nl

Array parameter expansion with non-space-IFS on bash-3/4

2009-11-27 Thread Freddy Vulto
\n ${@/q}' x a b a b Bash-4 seems to give the desired result (leave the array intact), but it's a bug on bash-3? Regards, Freddy Vulto http://fvue.nl

compopt +o

2009-10-02 Thread Freddy Vulto
it goes all right (c): $ a TABfoo= ^C # Ok. Reference with -o filenames disabled $ b TABfoo\= ^C # OK. Reference with -o filenames enabled $ c TABfoo\= ^C # OK $ d TABfoo\= ^C # Expected foo= (-o filenames disabled) Regards, Freddy Vulto http://fvue.nl

Re: Resolving quoted COMP_CWORD on bash-4

2009-09-27 Thread Freddy Vulto
: $ b'TAB doesn't complete with commands but with local filenames, although this is a valid command: $ b'ash' All in all, the patch seems like an improvement to me. Freddy Vulto http://fvue.nl

Completion called within command substitution

2009-09-25 Thread Freddy Vulto
# This returns `b' all right. Regards, Freddy Vulto http://fvue.nl

Resolving quoted COMP_CWORD on bash-4

2009-09-17 Thread Freddy Vulto
cTAB Regards, Freddy Vulto http://fvue.nl

Sourcing shopt setting removes 'history' from SHELLOPTS

2009-09-14 Thread Freddy Vulto
-comments:monitor:vi Regards, Freddy Vulto http://fvue.nl

Strange hostname completions after unset HOSTFILE

2009-08-02 Thread Freddy Vulto
-A hostname localhost freddy $ unset -v HOSTFILE $ compgen -A hostname � � $ I tested on another machine with bash-3.1 (patch level 17), having the same problem. Regards, Freddy Vulto http://fvue.nl

Re: (set -u -e; trap true EXIT; echo $bad) exits 0

2009-04-10 Thread Freddy Vulto
Even within the EXIT trap, the -u error exit status disappears when -e is used (?): $ (set -u; trap 'echo $?' EXIT; echo $bad) bash: bad: unbound variable 1 $ (set -eu; trap 'echo $?' EXIT; echo $bad) bash: bad: unbound variable 0 Freddy Vulto http://fvue.nl

Re: Migrating from tcsh to bash (issues)

2009-02-03 Thread Freddy Vulto
# Reset trap Freddy Vulto http://fvue.nl

Re: Migrating from tcsh to bash (issues)

2009-02-03 Thread Freddy Vulto
My mistake, the 'trap' of (5) needs to be defined within single quotes to prevent the $? from expanding too soon: $ trap 'echo Exit $?' ERR Freddy Vulto

Subshell inheritance of -e

2008-12-20 Thread Freddy Vulto
`$()' if `-e' set explicitly (set -e; echo P; false; echo Q) (set -e; echo R; false; echo S) # output: PQR; exits within right `()' only ---8--- Regards, Freddy Vulto