mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-20 03:02:29 +01:00
This adds two functions to modify your PATH.
Both functions check to see if the directories that will be inserted into your PATH are currently on the system. This is good for having one zshrc file and deploying it to myltiple enviroments.
This commit is contained in:
parent
7f07facf41
commit
086e78b68b
1 changed files with 24 additions and 0 deletions
|
|
@ -73,3 +73,27 @@ function env_default() {
|
|||
env | grep -q "^$1=" && return 0
|
||||
export "$1=$2" && return 3
|
||||
}
|
||||
|
||||
#
|
||||
# Prepends the PATH varible with the input path
|
||||
#
|
||||
# Arguments:
|
||||
# 1. path - The path that will be prepened
|
||||
# Return value:
|
||||
# 0 if PATH is exported to ENV
|
||||
#
|
||||
function prepend_path() {
|
||||
[[ -d "$1" ]] && export PATH="$1":$PATH && return 0
|
||||
}
|
||||
|
||||
#
|
||||
# Prepends the PATH varible with the input path
|
||||
#
|
||||
# Arguments:
|
||||
# 1. path - The path that will be prepened
|
||||
# Return value:
|
||||
# 0 if PATH is exported to ENV
|
||||
#
|
||||
function postpend_path() {
|
||||
[[ -d "$1" ]] && export PATH=$PATH:"$1" && return 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue