diff options
| author | Jokler <jokler.contact@gmail.com> | 2019-05-22 17:38:58 +0200 |
|---|---|---|
| committer | Jokler <jokler.contact@gmail.com> | 2019-05-22 17:38:58 +0200 |
| commit | 0b0e59d9dda5571b69e3883b6a3ae356dbae828e (patch) | |
| tree | dc3dee94262a424d7567bb6385e15417630276e3 /scripts/autoscript | |
| parent | ff207603f32d48594901b2f312c8c8b224d3171b (diff) | |
| download | dotfiles-0b0e59d9dda5571b69e3883b6a3ae356dbae828e.tar.gz dotfiles-0b0e59d9dda5571b69e3883b6a3ae356dbae828e.zip | |
Scripts: Make some scripts POSIX shell compliant
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 |
