Hi folks,
I execute the following code in Bash version "GNU bash, Version
4.2.39(1)-release (x86_64-redhat-linux-gnu)":
function foobar {
declare -rgA FOOBAR=([foo]=bar)
}
foobar
declare -p FOOBAR
# Output: declare -Ar FOOBAR='()'
Why doesn't Bash initialize FOOBAR with ([foo]=bar) according t
Hi folks,
when I execute the following code in Bash version "GNU bash, version
4.1.10(4)-release (i686-pc-cygwin)", I get:
declare a
declare -p a
# Output: -bash: declare: a: not found
declare -i b
declare -p b
# Output: -bash: declare: b: not found
declare -a c
declare -p c
# Output: declare -a
Hi folks,
I came accross the `-v` option of the `test` command and wondered how I
would possibly test not only string- and integer- but also array variables
as a whole and in parts.
I thought it should be possible to say:
declare -Ai foobar=([bar]=0)
test -v foobar[foo] && echo true || echo fals
Hi folks,
I execute the following code with Bash version "GNU bash, Version
4.2.39(1)-release (x86_64-redhat-linux-gnu)" on Fedora 17:
# Returns 0 else 1 if the sourcing (source) script isn't keyed by its base
name in the global "ONCE" array yet.
#
# A script should include this script near the t
Hi folks,
why is it that I can't say:
exec 3>/dev/null
echo foobar &>&3
# Error: "-bash: syntax error near unexpected token `&'"
but the following works:
echo foobar &>/dev/null
echo foobar >&3 2>&3
I think the succinct notation "&>&N" where N is some numbered file
descriptor should work also.
Hi,
executing the following code in GNU bash, Version 4.2.45(1)-release
(x86_64-redhat-linux-gnu), Fedora 19 ...
shopt -s extglob
export
HISTIGNORE="!(+(!([[\:space\:]]))+([[\:space\:]])+(!([[\:space\:]])))"
declare -p HISTIGNORE
... brings bash to a full stop. It does not print a c
/home/tifr/.cache/bash/history"
Any ideas as to how to correctly assign the "+([^[:space:]])" pattern
to the "HISTIGNORE" variable? By the way I'm setting the history
related variables from my ".bash_login" file. That is why I'm
exporting them.
Than
nvince bash's
history with the following definitions:
1.) HISTIGNORE="+([[:word:]])"
2.) HISTIGNORE="+([^[:space:]])"
On the other hand such simple definitions work:
1.) HISTIGNORE="+([a-z])"
2.) HISTIGNORE="+([-0-9A-Z_a-z])"
Best regards
Tim
2014/1/12 T
Hi,
see my question
http://unix.stackexchange.com/questions/137506/how-to-combine-bashs-process-substitution-with-here-document
for a description.
Could the described behavior be a bug?
Kind regards
Tim
Hi,
first I want to thank you for your help.
While searching for an alternative I came up with the following code
which does not work when I have the "shopt -os errexit" command line
at the top of my script:
read -d '' -r foobar <:
> On 6/18/14, 4:27 PM, Dan Douglas wrote:
>> On Wed, Jun 18, 201
Hi,
my assumption was that Bash's "printf" builtin implicitly defines a local
variable when used inside a function like so:
function foobar { printf -v foo bar; }
foobar
declare -p foo
# Prints "bar" from the global "foo" variable.
But instead I have to declare the "foo" variable
Hi,
as I see it the "source" built-in is perfect for embedding a sourced
Bash script into the sourcing one while preserving as much of the
environment, specifically the positional and special parameters, as
possible.
What I am missing is the "import" built-in that passes only the
explicitly given
Hi,
when I define the following function:
$ function foo {
> echo bar
> }
and try to run it, I get:
$ foo
bar
but try to print its definition with "declare", I get:
$ declare -p foo
bash: declare: foo: not found
$ declare -pf foo
bash: declare: foo: not found
$declare -pF
13 matches
Mail list logo