Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15090

continued alias problem -- some work, some don't, why?

From L A Walsh <bash@tlinx.org>
Newsgroups gnu.bash.bug
Subject continued alias problem -- some work, some don't, why?
Date 2019-07-08 15:30 -0700
Message-ID <mailman.526.1562625062.2688.bug-bash@gnu.org> (permalink)
References <5D23C417.5060108@tlinx.org>

Show all headers | View raw


I have been trying to use something like a continued alias (space
following the expansion).

So I have several modifies on a var
my -a -i -x foobar=(1 2 3)
my -p foobar
declare -aix foobar=([0]="1" [1]="2" [2]="3")


That's what I am wanting, But trying various aliases, I'm not getting
consistent results:
With these aliases:
alias my='declare '
alias Export='-x '
alias Map='-A '
alias Int='-i '

my Export Map Int ffffe=([one]=1)
-bash: declare: `-x': not a valid identifier
-bash: declare: `-A': not a valid identifier
-bash: declare: `-i': not a valid identifier

But: this does:
declare -x -A -i foo7=([one]=1 [two]=2)> my -p foo7
my -p foo7
declare -Aix foo7=([two]="2" [one]="1" )

Part of it appears to be the word Export in a declaration -- will tend to
ignore other things, but using the flag -x, will set the flag w/no error.

So why do aliases of '-x ' not work where a bare '-x' do?.

Annoying is when you get some error trying to create a map, -- then
the var will be created as an array, which, if you don't catch it makes
future
attempt to create a map of the same name fruitless.






Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

continued alias problem -- some work, some don't, why? L A Walsh <bash@tlinx.org> - 2019-07-08 15:30 -0700

csiph-web