dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 0336f1d4c14722ed6491f1915dc212d0dec7ce73
parent 7eebdcefc8e70d1594df810447b07924e4b91562
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Mon, 27 May 2019 07:41:42 +0200

Rewrite o() for POSIX sh compliance

Diffstat:
M.commands.sh | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/.commands.sh b/.commands.sh @@ -38,9 +38,11 @@ o() { 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") - file=$(head -2 <<< "$out" | tail -1) + IFS= out=$(fzf --query="$1" --exit-0 \ + --expect=ctrl-o,ctrl-e,ctrl-y \ + --preview-window=hidden) + key=$(echo "$out" | sed 1q) + file=$(echo "$out" | sed 2q | tail -1) if [ -n "$file" ]; then if [ "$key" = ctrl-e ]; then ${EDITOR:-vim} "$file" @@ -203,4 +205,5 @@ gcagp_all_sl() { done } +# shellcheck source=/dev/null [ -f ~/.shortcuts ] && . ~/.shortcuts