Don't attempt to set invalid environment variable names
This commit is contained in:
parent
501353a534
commit
b95b365276
8
zshrc
8
zshrc
@ -172,7 +172,13 @@ if [[ ! -z "$cursor_block" && ! -z "$cursor_line" ]]; then
|
||||
fi
|
||||
|
||||
# Frequntly used directories
|
||||
function frequent-directory() { export $1; hash -d $1 }
|
||||
function frequent-directory() {
|
||||
# Replace - with _ in environment variable name.
|
||||
local name=$(echo $1 | sed 's/^\(.*\)=.*$/\1/g' | sed 's/-/_/g')
|
||||
local value=$(echo $1 | sed 's/^.*=\(.*$\)/\1/g')
|
||||
export $name=$value
|
||||
hash -d $1
|
||||
}
|
||||
frequent-directory Projects="$HOME/Projects"
|
||||
frequent-directory Sandbox="$HOME/Sandbox"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user