mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-03 01:48:19 +00:00
feat: x-path-* as scripts, run other changes
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
which "$1" >&/dev/null
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo 0
|
||||
exit 0
|
||||
else
|
||||
echo 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
8
local/bin/x-path-append
Executable file
8
local/bin/x-path-append
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Add a directory to the beginning of the PATH if it's not already there.
|
||||
# Usage: x-path-append <dir>
|
||||
|
||||
x-path-remove "$1"
|
||||
export PATH="${PATH:+"$PATH:"}$1"
|
||||
|
||||
7
local/bin/x-path-prepend
Executable file
7
local/bin/x-path-prepend
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Add a directory to the front of the PATH if it exists and is not already there
|
||||
# Usage: x-path-prepend <dir>
|
||||
|
||||
export PATH="$1${PATH:+":$PATH"}"
|
||||
|
||||
7
local/bin/x-path-remove
Executable file
7
local/bin/x-path-remove
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Remove a directory from the PATH
|
||||
# Usage: x-path-remove <dir>
|
||||
|
||||
export PATH=$(echo -n "$PATH" | awk -v RS=: -v ORS=: "\$0 != \"$1\"" | sed 's/:$//')
|
||||
|
||||
Reference in New Issue
Block a user