mirror of
https://github.com/Tarrasch/zsh-autoenv.git
synced 2025-02-16 15:04:43 +02:00
Fix stashing aliases with a space in double quotes
This commit is contained in:
parent
f5951dd0cf
commit
4069af9cd0
@ -108,6 +108,7 @@ function stash() {
|
||||
local alias_def="$(eval alias $stash_which 2>/dev/null)"
|
||||
if [[ -n $alias_def ]]; then
|
||||
alias_def=${alias_def#alias }
|
||||
alias_def=$(echo "$alias_def" | sed 's/"/\\&/g') # Escape double quotes
|
||||
eval "__varstash_alias__$stash_name=\"$alias_def\""
|
||||
local stashed=1
|
||||
fi
|
||||
|
@ -13,9 +13,9 @@ Setup test environment.
|
||||
|
||||
Aliases should be stashed.
|
||||
|
||||
$ alias some_alias="echo ORIG_ALIAS"
|
||||
$ alias some_alias='echo "ORIG ALIAS"'
|
||||
$ some_alias
|
||||
ORIG_ALIAS
|
||||
ORIG ALIAS
|
||||
$ cd .
|
||||
ENTER
|
||||
$ some_alias
|
||||
@ -23,13 +23,13 @@ Aliases should be stashed.
|
||||
$ cd ..
|
||||
LEAVE
|
||||
$ some_alias
|
||||
ORIG_ALIAS
|
||||
ORIG ALIAS
|
||||
|
||||
Aliases should be stashed, if there are also environment variables.
|
||||
|
||||
$ some_alias=ENV_VAR
|
||||
$ some_alias
|
||||
ORIG_ALIAS
|
||||
ORIG ALIAS
|
||||
$ cd sub
|
||||
ENTER
|
||||
$ type -w some_alias
|
||||
|
Loading…
x
Reference in New Issue
Block a user