[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Incorrect alias expansion within command substitution
From: |
Greg Wooledge |
Subject: |
Re: Incorrect alias expansion within command substitution |
Date: |
Thu, 3 Feb 2022 16:19:08 -0500 |
On Fri, Feb 04, 2022 at 02:52:34AM +0700, Robert Elz wrote:
> You could instead use:
>
> my()
> {
> local A=
> while [ $# -gt 0 ]
> do
> case "$1" in
> int) A="${A} -i";;
> map) A="${A} -A";;
> array) A="${A} -a";;
> ....) # as many more as you need
> *) break;;
> esac
> shift
> done
> declare $A -- "$@"
> }
> int() { my int "$@"; }
> array() { my array "$@"; }
> (etc)
This declares the variables at the wrong scope. They won't be usable
in the function where you call "my". In order to make this work, you'd
need something equivalent to Tcl's uplevel command.
That said, I agree with your point, and I would never use the things
that Ms. Walsh is advocating.
- Re: Incorrect alias expansion within command substitution, (continued)
- Re: Incorrect alias expansion within command substitution, Alex fxmbsw7 Ratchev, 2022/02/02
- Re: Incorrect alias expansion within command substitution, Chet Ramey, 2022/02/03
- Re: Incorrect alias expansion within command substitution, Robert Elz, 2022/02/02
- Re: Incorrect alias expansion within command substitution, Alex fxmbsw7 Ratchev, 2022/02/03
- Re: Incorrect alias expansion within command substitution, L A Walsh, 2022/02/03
- Re: Incorrect alias expansion within command substitution, Alex fxmbsw7 Ratchev, 2022/02/03
- Re: Incorrect alias expansion within command substitution, Dennis Williamson, 2022/02/03
- Re: Incorrect alias expansion within command substitution, Alex fxmbsw7 Ratchev, 2022/02/03
- Re: Incorrect alias expansion within command substitution, Chet Ramey, 2022/02/03
- Re: Incorrect alias expansion within command substitution, Robert Elz, 2022/02/03
- Re: Incorrect alias expansion within command substitution,
Greg Wooledge <=
- Re: Incorrect alias expansion within command substitution, Robert Elz, 2022/02/03
- Re: Incorrect alias expansion within command substitution, Chet Ramey, 2022/02/03
- Re: Incorrect alias expansion within command substitution, Chet Ramey, 2022/02/03
- Re: Incorrect alias expansion within command substitution, L A Walsh, 2022/02/03
- Re: Incorrect alias expansion within command substitution, Alex fxmbsw7 Ratchev, 2022/02/03
- Re: Incorrect alias expansion within command substitution, Chet Ramey, 2022/02/03