oneliners/bash/friendly_path-export.sh

7 lines
165 B
Bash
Raw Permalink Normal View History

2024-02-08 00:53:43 +01:00
#!/bin/bash
# exports a path only, if $PATH does not already contains the path.
NEWPATH="$1"
echo ":$PATH:" | grep -q ":$NEWPATH:" || export PATH="$PATH:$NEWPATH"