A collection of scripts and configurations for Bash (and others)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- #!/bin/bash
-
- function in_envpath()
- {
- for path in $(sed 's/:/\n/g' <<< $PATH)
- do
- if [ $path = $1 ]; then
- return 0 # 0 = success!
- fi
- done
- return 1 # non-zero = failure
- }
-
-
- function add_to_envpath()
- {
- if in_envpath $1; then
- return 0 # Success! Path is already IN $PATH
- fi
- if [ -d "$1" ]; then
- PATH="$PATH:$1"
- fi
- }
-
|