summaryrefslogtreecommitdiffstats
path: root/scripts/autoscript
blob: 4358e8ca9d1ca439cd339dda39a8aa51a9eaf8c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

if [ "$#" -ne 1 ]; then
    echo "Exactly 1 argument is required"
    exit
fi

SCRIPT_FOLDER="$HOME/scripts"
SCRIPT_FILE="$SCRIPT_FOLDER/$1"

if [ -f "$SCRIPT_FILE" ]; then
  gvim "$SCRIPT_FILE" &
else

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