From 4d89628dc246e8c0b40cac48cadebd9e38335dba Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 2 May 2015 12:13:06 -0400 Subject: I can't believe I pushed a broken v-editor --- v-editor.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/v-editor.sh b/v-editor.sh index e6df2b3..2d0f52f 100644 --- a/v-editor.sh +++ b/v-editor.sh @@ -1,11 +1,12 @@ #!/bin/bash run() { - local editor=$1; shift - local cmd - eval "cmd=($(printf '%q ' "$editor"))" - cmd+=("$@") - "${cmd[@]}" + local prog="$1"; shift + local args='' + if [[ $# -gt 0 ]]; then + printf -v args -- ' %q' "$@" + fi + eval "${prog}${args}" } (if [ -n "$DISPLAY" ]; then run "${VISUAL:-$SELECTED_EDITOR}" "$@" -- cgit v1.2.3