diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-05-02 12:13:06 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-05-02 12:13:06 -0400 |
commit | 4d89628dc246e8c0b40cac48cadebd9e38335dba (patch) | |
tree | 011dff156009949d04c2d7029b4b135a6838abcb | |
parent | 49a8f558596d2a287793e12ebac60c026f608df1 (diff) |
I can't believe I pushed a broken v-editor
-rw-r--r-- | v-editor.sh | 11 |
1 files 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}" "$@" |