summaryrefslogtreecommitdiffstats
path: root/scripts/autoscript
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2019-05-22 17:38:58 +0200
committerJokler <jokler.contact@gmail.com>2019-05-22 17:38:58 +0200
commit0b0e59d9dda5571b69e3883b6a3ae356dbae828e (patch)
treedc3dee94262a424d7567bb6385e15417630276e3 /scripts/autoscript
parentff207603f32d48594901b2f312c8c8b224d3171b (diff)
downloaddotfiles-0b0e59d9dda5571b69e3883b6a3ae356dbae828e.tar.gz
dotfiles-0b0e59d9dda5571b69e3883b6a3ae356dbae828e.zip
Scripts: Make some scripts POSIX shell compliant
Diffstat (limited to 'scripts/autoscript')
-rwxr-xr-xscripts/autoscript18
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