Permalink
Browse files
Accept 'shopt -s expand_aliases' as a noop.
Add more spec test cases for alias.
- Loading branch information...
Showing
with
19 additions
and
2 deletions.
-
+3
−1
core/state.py
-
+16
−1
spec/alias.test.sh
|
|
@@ -154,6 +154,8 @@ def __init__(self, mem): |
|
|
# these.
|
|
|
self.nullglob = False
|
|
|
self.failglob = False
|
|
|
# No-op for bash compatibility. We always expand aliases.
|
|
|
self.expand_aliases = False
|
|
|
|
|
|
#
|
|
|
# OSH-specific options that are not yet implemented.
|
|
|
@@ -251,7 +253,7 @@ def SetOption(self, opt_name, b): |
|
|
new_val = runtime.Str(':'.join(names))
|
|
|
self.mem.InternalSetGlobal('SHELLOPTS', new_val)
|
|
|
|
|
|
SHOPT_OPTIONS = ('nullglob', 'failglob')
|
|
|
SHOPT_OPTIONS = ('nullglob', 'failglob', 'expand_aliases')
|
|
|
|
|
|
def SetShoptOption(self, opt_name, b):
|
|
|
""" For shopt -s/-u. """
|
|
|
|
|
|
@@ -4,7 +4,7 @@ |
|
|
#
|
|
|
# http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_03_01
|
|
|
#
|
|
|
# Bash is the only one that doesn't support aliases!
|
|
|
# Bash is the only one that doesn't support aliases by default!
|
|
|
|
|
|
#### Basic alias
|
|
|
shopt -s expand_aliases # bash requires this
|
|
|
@@ -18,6 +18,21 @@ hi |
|
|
expected failure
|
|
|
## END
|
|
|
|
|
|
#### define and use alias on a single line
|
|
|
shopt -s expand_aliases
|
|
|
alias e=echo; e one # this is not alias-expanded because we parse lines at once
|
|
|
e two; e three
|
|
|
## STDOUT:
|
|
|
two
|
|
|
three
|
|
|
## END
|
|
|
|
|
|
#### alias can override builtin
|
|
|
shopt -s expand_aliases
|
|
|
alias echo='echo foo'
|
|
|
echo bar
|
|
|
## stdout: foo bar
|
|
|
|
|
|
#### defining multiple aliases, then unalias
|
|
|
shopt -s expand_aliases # bash requires this
|
|
|
x=x
|
|
|
|
0 comments on commit
29de900