bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: L A Walsh
Subject: continued alias problem -- some work, some don't, why?
Date: Mon, 08 Jul 2019 15:30:47 -0700
User-agent: Thunderbird

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.









reply via email to

[Prev in Thread] Current Thread [Next in Thread]