aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/%HOME%
diff options
context:
space:
mode:
Diffstat (limited to '%HOME%')
-rw-r--r--%HOME%/.bash_profile9
-rw-r--r--%HOME%/.bash_utils/path.sh10
-rw-r--r--%HOME%/.bashrc16
-rw-r--r--%HOME%/.profile5
4 files changed, 21 insertions, 19 deletions
diff --git a/%HOME%/.bash_profile b/%HOME%/.bash_profile
index b545321..bb4d98e 100644
--- a/%HOME%/.bash_profile
+++ b/%HOME%/.bash_profile
@@ -1,13 +1,14 @@
-[ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc"
+[ -r "$HOME/.bashrc" ] && source "$HOME/.bashrc"
echo "Welcome to $( hostname )"
spawn_ssh_agent() {
[ -n "${SSH_AGENT_PID:+x}" ] && return 0
- eval "$( ssh-agent -s )" > /dev/null \
- && trap "$( printf 'kill %q' "$SSH_AGENT_PID" )" 0 \
- && ssh-add &> /dev/null
+ command -v ssh-agent &> /dev/null \
+ && eval "$( ssh-agent -s )" > /dev/null \
+ && [ -n "${SSH_AGENT_PID:+x}" ] \
+ && trap "$( printf 'kill %q' "$SSH_AGENT_PID" )" 0
}
[ "$( uname -o )" == 'Cygwin' ] && spawn_ssh_agent
diff --git a/%HOME%/.bash_utils/path.sh b/%HOME%/.bash_utils/path.sh
index 644ed00..b9e78b6 100644
--- a/%HOME%/.bash_utils/path.sh
+++ b/%HOME%/.bash_utils/path.sh
@@ -17,7 +17,7 @@ add_missing_path() (
while IFS= read -d '' -r path; do
new_paths+=("$path")
- done < <( readlink --zero --canonicalize-missing "$@" )
+ done < <( readlink --zero --canonicalize-missing -- "$@" )
for path; do
if str_contains "$path" ':'; then
@@ -30,7 +30,7 @@ add_missing_path() (
while IFS= read -d '' -r path; do
old_paths[$path]=1
- done < <( str_split -z -- "${PATH-}" ':' | xargs --null readlink --zero --canonicalize-missing )
+ done < <( str_split -z -- "${PATH-}" ':' | xargs --null readlink --zero --canonicalize-missing -- )
for path in ${new_paths[@]+"${new_paths[@]}"}; do
old_paths[$path]=1
@@ -40,6 +40,8 @@ add_missing_path() (
)
add_path() {
- PATH="$( add_missing_path "$@" )" || return $?
- export PATH
+ local new_path
+
+ new_path="$( add_missing_path "$@" )" \
+ && export PATH="$new_path"
}
diff --git a/%HOME%/.bashrc b/%HOME%/.bashrc
index 7ef4910..5efe8d9 100644
--- a/%HOME%/.bashrc
+++ b/%HOME%/.bashrc
@@ -1,6 +1,6 @@
case "$-" in
*i*) ;;
- *) return ;;
+ *) return ;;
esac
PS1='\[\e[33m\]\W\[\e[0m\]: '
@@ -29,12 +29,12 @@ alias tree='tree -a'
[ "$( uname -o )" == 'Cygwin' ] && alias list_packages='cygcheck -cd'
-[ -f "$HOME/.bash_utils/cxx.sh" ] && source "$HOME/.bash_utils/cxx.sh"
-[ -f "$HOME/.bash_utils/distr.sh" ] && source "$HOME/.bash_utils/distr.sh"
-[ -f "$HOME/.bash_utils/file.sh" ] && source "$HOME/.bash_utils/file.sh"
-[ -f "$HOME/.bash_utils/git.sh" ] && source "$HOME/.bash_utils/git.sh"
-[ -f "$HOME/.bash_utils/path.sh" ] && source "$HOME/.bash_utils/path.sh"
-[ -f "$HOME/.bash_utils/text.sh" ] && source "$HOME/.bash_utils/text.sh"
+[ -r "$HOME/.bash_utils/cxx.sh" ] && source "$HOME/.bash_utils/cxx.sh"
+[ -r "$HOME/.bash_utils/distr.sh" ] && source "$HOME/.bash_utils/distr.sh"
+[ -r "$HOME/.bash_utils/file.sh" ] && source "$HOME/.bash_utils/file.sh"
+[ -r "$HOME/.bash_utils/git.sh" ] && source "$HOME/.bash_utils/git.sh"
+[ -r "$HOME/.bash_utils/path.sh" ] && source "$HOME/.bash_utils/path.sh"
+[ -r "$HOME/.bash_utils/text.sh" ] && source "$HOME/.bash_utils/text.sh"
export PYTHONSTARTUP="$HOME/.pythonrc"
@@ -44,7 +44,7 @@ update_ruby_settings() {
command -v ruby &> /dev/null \
&& command -v gem &> /dev/null \
&& user_dir="$( ruby -e 'print Gem.user_dir' )" \
- && add_path "$user_dir" \
+ && add_path -- "$user_dir" \
&& export GEM_HOME="$user_dir"
}
diff --git a/%HOME%/.profile b/%HOME%/.profile
index 056d9db..43c0e81 100644
--- a/%HOME%/.profile
+++ b/%HOME%/.profile
@@ -1,6 +1,5 @@
-LANG="$( locale --no-unicode --utf )"
-export LANG
+LANG="$( locale --no-unicode --utf )" && export LANG
[ -n "${BASH_VERSION+x}" ] \
- && [ -f "$HOME/.bashrc" ] \
+ && [ -r "$HOME/.bashrc" ] \
&& source "$HOME/.bashrc"