diff options
Diffstat (limited to 'scripts/autoscript')
| -rwxr-xr-x | scripts/autoscript | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/scripts/autoscript b/scripts/autoscript index c29bcc9..4358e8c 100755 --- a/scripts/autoscript +++ b/scripts/autoscript @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh if [ "$#" -ne 1 ]; then echo "Exactly 1 argument is required" @@ -8,12 +8,18 @@ fi SCRIPT_FOLDER="$HOME/scripts" SCRIPT_FILE="$SCRIPT_FOLDER/$1" -if [[ -f $SCRIPT_FILE ]]; then - gvim $SCRIPT_FILE +if [ -f "$SCRIPT_FILE" ]; then + gvim "$SCRIPT_FILE" & else - echo -e '#!/bin/bash\n\n# vim: expandtab sw=2 ts=2' > $SCRIPT_FILE - chmod +x $SCRIPT_FILE - gvim $SCRIPT_FILE & + +cat >> "$SCRIPT_FILE" <<EOF +#!/bin/sh + +# vim: expandtab sw=2 ts=2 +EOF + + chmod +x "$SCRIPT_FILE" + gvim "$SCRIPT_FILE" & fi # vim: expandtab sw=2 ts=2 |
