commit 55fadd5af9ae61a98890dd31b1068e046af7fd98
parent aa3ade260d1cc0b06f6fa987a6d2eb51e942ff11
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 24 May 2019 12:56:12 +0200
Small fixes for POSIX sh compatibility
Diffstat:
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/.commands.sh b/.commands.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#### FUNCTIONS AND ALIASES
@@ -34,10 +34,9 @@ alias la='ls -A'
## Open files
o() {
- [[ "$(uname)" == 'Darwin' ]] && open="open" || open="xdg-open"
- if [[ "$#" -gt 0 && -f "$1" ]]; then
- $open "$1" >/dev/null 2>&1 &
- disown $!
+ [ "$(uname)" = 'Darwin' ] && open="open" || open="xdg-open"
+ if [ "$#" -gt 0 ] && [ -f "$1" ]; then
+ nohup $open "$1" >/dev/null 2>&1 &
else
IFS=$'\n' out=($(fzf --query="$1" --exit-0 --expect=ctrl-o,ctrl-e,ctrl-y --preview-window=hidden))
key=$(head -1 <<< "$out")
@@ -48,19 +47,16 @@ o() {
elif [ "$key" = ctrl-y ]; then
printf "%s" "$PWD/$file" | xclip
elif [ "$key" = ctrl-o ]; then
- cd "$(dirname "$file")"
+ cd "$(dirname "$file")" || return
else
- $open "$file" >/dev/null 2>&1 &
- disown $!
+ nohup $open "$file" >/dev/null 2>&1 &
fi
fi
fi
}
## dotfiles
-alias zshreload="source ~/.zshrc"
alias dotfiles="git --git-dir=\$HOME/.dotfiles/ --work-tree=\$HOME"
-alias dotfiles-update="dotfiles pull && zshreload"
alias dotfiles-commit="dotfiles commit -a -S -v ; dotfiles push"
## python