From 5afbb937cf4df309721cf271d0802f470380dffe Mon Sep 17 00:00:00 2001 From: zeus Date: Thu, 25 May 2023 14:28:43 +0200 Subject: [PATCH] add: friendly path-export & open startfiles for bash --- bash/bash-open-startfiles.sh | 5 +++++ bash/friendly_path-export.sh | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100755 bash/bash-open-startfiles.sh create mode 100755 bash/friendly_path-export.sh diff --git a/bash/bash-open-startfiles.sh b/bash/bash-open-startfiles.sh new file mode 100755 index 0000000..609f436 --- /dev/null +++ b/bash/bash-open-startfiles.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# lists all files, an interactive login-shell with bash would try to open. Useful to find the correct order of .bashrc .profile and such. + +echo exit | strace bash -li |& grep '^open' diff --git a/bash/friendly_path-export.sh b/bash/friendly_path-export.sh new file mode 100755 index 0000000..5fcd524 --- /dev/null +++ b/bash/friendly_path-export.sh @@ -0,0 +1,6 @@ +#/!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"