# Add ~/bin and subdirs to PATH if needed
while read -r p; do
echo "$PATH" | tr ':' '\n' | grep -qxF "$p" || PATH="${p}:$PATH"
-done < <(find -L ~/bin -maxdepth 1 -type d 2> /dev/null)
+done < <(find -L ~/bin -depth -maxdepth 1 -type d 2> /dev/null)
-# Set EMAIL from the freedesktop environment.d
-if ls ~/.config/environment.d/*.conf &> /dev/null; then
- eval "$(awk -F= '{print $0 ";export " $1}' ~/.config/environment.d/*.conf)"
-fi
+# Set environment variables, eg EMAIL, LANG
+eval "$(cat 2> /dev/null /etc/default/locale /etc/locale.conf ~/.config/environment.d/*.conf | awk -F= '/^[^# ]/ {print $0 ";export " $1}')"
# Pick up SSH agent socket
if [ -z "$SSH_AUTH_SOCK" ]; then
# ls aliases and colours #
##########################
-# GNU ls colours
-eval "$(TERM=xterm dircolors 2> /dev/null)"
-
-# BSD ls colours
-export LSCOLORS="ExFxCxDxBxEGEDABAGACAD"
+if command -v dircolors &> /dev/null; then
+ # GNU ls colours
+ eval "$(dircolors)"
+ LS_COLORS+=':ow=30;42'
+else
+ # BSD ls colours
+ export LSCOLORS="ExFxCxDxBxEGEDABAGACAD"
+fi
# Lets find the ls
if ls --color=auto -v &> /dev/null; then
renice -n 19 -p $$
}
-# SSH to an unknown host and print the new known_hosts entry
-function ssh_new {
- local new_known_hosts_file
- new_known_hosts_file="$(mktemp)"
- ssh -o UserKnownHostsFile="$new_known_hosts_file" "$@" echo 'Connection ok'
- cat "$new_known_hosts_file"
- rm -f "$new_known_hosts_file"
-}
-
# SSH without verifying host key
function ssh_unsafe {
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$@"
if emacsclient --version &> /dev/null; then
export ALTERNATE_EDITOR='vim'
export EDITOR='emacsclient --tty'
-
- if [[ "$TERM" == screen* ]]; then
- aliasf edit 'emacsclient --tty'
- else
- aliasf edit 'emacsclient --create-frame --no-wait'
- fi
else
export EDITOR='vim'
- aliasf edit 'vim'
fi
+aliasf edit "$EDITOR"
#########################