2008-03-27 10:41:08 +01:00
|
|
|
# To get the "command not found" message when aliasing is suppressed
|
|
|
|
# we need, er, a command that isn't found.
|
|
|
|
# The other aliases are only ever used as aliases.
|
|
|
|
|
2001-04-02 14:30:15 +02:00
|
|
|
%prep
|
2008-03-27 10:41:08 +01:00
|
|
|
alias ThisCommandDefinitelyDoesNotExist=echo
|
2001-04-02 14:30:15 +02:00
|
|
|
|
|
|
|
alias -g bar=echo
|
|
|
|
|
|
|
|
alias '\bar=echo'
|
|
|
|
|
|
|
|
%test
|
2008-03-27 10:41:08 +01:00
|
|
|
ThisCommandDefinitelyDoesNotExist ThisCommandDefinitelyDoesNotExist
|
2001-04-02 14:30:15 +02:00
|
|
|
0:Basic aliasing
|
2008-03-27 10:41:08 +01:00
|
|
|
>ThisCommandDefinitelyDoesNotExist
|
2001-04-02 14:30:15 +02:00
|
|
|
|
|
|
|
bar bar
|
|
|
|
0:Global aliasing
|
|
|
|
>echo
|
|
|
|
|
2008-03-27 10:41:08 +01:00
|
|
|
\ThisCommandDefinitelyDoesNotExist ThisCommandDefinitelyDoesNotExist
|
2001-06-25 05:06:33 +02:00
|
|
|
127:Not aliasing
|
2008-03-26 16:26:20 +01:00
|
|
|
?(eval):1: command not found: ThisCommandDefinitelyDoesNotExist
|
2001-04-02 14:30:15 +02:00
|
|
|
|
|
|
|
\bar \bar
|
|
|
|
0:Aliasing with a backslash
|
|
|
|
>bar
|
2009-03-03 18:26:03 +01:00
|
|
|
|
|
|
|
(alias '!=echo This command has the argument'
|
|
|
|
eval 'print Without
|
|
|
|
! true'
|
|
|
|
setopt posixaliases
|
|
|
|
eval 'print With
|
|
|
|
! true')
|
|
|
|
1:POSIX_ALIASES option
|
|
|
|
>Without
|
|
|
|
>This command has the argument true
|
|
|
|
>With
|
2010-03-25 15:03:40 +01:00
|
|
|
|
|
|
|
print -u $ZTST_fd 'This test hangs the shell when it fails...'
|
2010-03-25 16:13:35 +01:00
|
|
|
alias cat='LC_ALL=C cat'
|
|
|
|
cat <(echo foo | cat)
|
2010-03-25 15:03:40 +01:00
|
|
|
0:Alias expansion works at the end of parsed strings
|
|
|
|
>foo
|
2015-03-05 10:38:31 +01:00
|
|
|
|
2015-03-19 02:01:54 +01:00
|
|
|
alias -g '&&=(){ return $?; } && '
|
2015-03-05 10:38:31 +01:00
|
|
|
alias not_the_print_command=print
|
|
|
|
eval 'print This is output
|
|
|
|
&& print And so is this
|
|
|
|
&& { print And this too; false; }
|
|
|
|
&& print But not this
|
|
|
|
&& print Nor this
|
|
|
|
true
|
|
|
|
&& not_the_print_command And aliases are expanded'
|
|
|
|
0:We can now alias special tokens. Woo hoo.
|
|
|
|
>This is output
|
|
|
|
>And so is this
|
|
|
|
>And this too
|
|
|
|
>And aliases are expanded
|
2015-03-26 01:33:35 +01:00
|
|
|
|
|
|
|
$ZTST_testdir/../Src/zsh -fis <<<'
|
2015-05-08 10:36:01 +02:00
|
|
|
unsetopt PROMPT_SP
|
|
|
|
PROMPT="" PS2="" PS3="" PS4="" RPS1="" RPS2=""
|
2015-03-26 01:33:35 +01:00
|
|
|
exec 2>&1
|
|
|
|
alias \{=echo
|
|
|
|
{ begin
|
|
|
|
{end
|
|
|
|
fc -l -2' 2>/dev/null
|
|
|
|
0:Aliasing reserved tokens
|
|
|
|
>begin
|
2015-03-29 06:24:27 +02:00
|
|
|
>end
|
2015-05-08 10:36:01 +02:00
|
|
|
*>*5*{ begin
|
|
|
|
*>*6*{end
|
2015-03-26 01:33:35 +01:00
|
|
|
|
|
|
|
$ZTST_testdir/../Src/zsh -fis <<<'
|
2015-05-08 10:36:01 +02:00
|
|
|
unsetopt PROMPT_SP
|
|
|
|
PROMPT="" PS2="" PS3="" PS4="" RPS1="" RPS2=""
|
2015-03-26 01:33:35 +01:00
|
|
|
exec 2>&1
|
|
|
|
alias -g S=\"
|
|
|
|
echo S a string S "
|
|
|
|
fc -l -1' 2>/dev/null
|
|
|
|
0:Global aliasing quotes
|
|
|
|
> a string S
|
2015-05-08 10:36:01 +02:00
|
|
|
*>*5*echo S a string S "
|
2015-03-26 01:33:35 +01:00
|
|
|
# Note there is a trailing space on the "> a string S " line
|
2015-05-18 17:56:36 +02:00
|
|
|
|
|
|
|
(
|
|
|
|
unalias -a
|
|
|
|
alias
|
|
|
|
)
|
|
|
|
0:unalias -a
|
|
|
|
|
|
|
|
alias -s foo=print
|
2015-09-02 17:33:22 +02:00
|
|
|
type bar.foo; type -w bar.foo
|
2015-05-18 17:56:36 +02:00
|
|
|
unalias -as
|
|
|
|
0:unalias -as
|
2015-09-02 17:33:22 +02:00
|
|
|
>foo is a suffix alias for print
|
|
|
|
>foo: suffix alias
|
2016-01-13 01:57:55 +01:00
|
|
|
|
|
|
|
aliases[x=y]=z
|
|
|
|
alias -L | grep x=y
|
|
|
|
echo $pipestatus[1]
|
|
|
|
0:printing invalid aliases warns
|
|
|
|
>0
|
|
|
|
?(eval):2: invalid alias 'x=y' encountered while printing aliases
|
|
|
|
# Currently, 'alias -L' returns 0 in this case. Perhaps it should return 1.
|
2016-06-22 14:10:22 +02:00
|
|
|
|
|
|
|
alias -s mysuff='print -r "You said it.";'
|
|
|
|
eval 'thingummy.mysuff'
|
|
|
|
127:No endless loop with suffix alias in command position
|
|
|
|
>You said it.
|
|
|
|
?(eval):1: command not found: thingummy.mysuff
|
2016-11-24 07:57:52 +01:00
|
|
|
|
|
|
|
alias +x; alias -z
|
|
|
|
1:error message has the correct sign
|
|
|
|
?(eval):alias:1: bad option: +x
|
|
|
|
?(eval):alias:1: bad option: -z
|