blob: 0837f723d46751e5e675428333f98d1b53fb28f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# posix-mode alias expansion in nofork command substitutions within
# other constructs
DATE='Mon Aug 29 20:03:02 EDT 2022'
shopt -s expand_aliases
alias number="echo 123"
echo ${ number; }
echo $(( ${ number; } ))
(( ${ number; } )) ; echo $?
set -o posix
echo ${ number; }
echo $(( ${ number; } ))
(( ${ number; } )) ; echo $?
set +o posix
# have to turn it back on after leaving posix mode
shopt -s expand_aliases
alias my_alias='echo $DATE'
echo ${ eval my_alias; }
echo ${ my_alias; }
set -o posix
echo ${ eval my_alias; }
echo ${ my_alias; }
set +o posix ; shopt -s expand_aliases
alias e=echo
alias v='e 123'
set -o posix
echo ${ v; }
echo ${ echo before ; v; }
echo ${ for f in 0; do
echo in for
done; v; }
set +o posix ; shopt -s expand_aliases
alias let='let --'
let '1 == 1'
: ${ let '1 == 1'; }
set -o posix
let '1 == 1'
: ${ let '1 == 1'; }
set +o posix ; shopt -s expand_aliases
|