diff options
| author | filip <“filip.rabiega@gmail.com”> | 2026-01-21 23:42:15 +0100 |
|---|---|---|
| committer | filip <“filip.rabiega@gmail.com”> | 2026-01-21 23:42:15 +0100 |
| commit | 17df35dc088c9b1b159c2b78d8330fa9cc9a672a (patch) | |
| tree | 052205953f7f11a9ea847a9b4d238f6acdbc25b8 /newscript | |
| parent | d127601c83c1a30063b76eb89bf0d9a32ed435b9 (diff) | |
| download | chadscripts-17df35dc088c9b1b159c2b78d8330fa9cc9a672a.tar.gz chadscripts-17df35dc088c9b1b159c2b78d8330fa9cc9a672a.tar.bz2 chadscripts-17df35dc088c9b1b159c2b78d8330fa9cc9a672a.zip | |
reformat most scripts
Diffstat (limited to 'newscript')
| -rwxr-xr-x | newscript | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -2,22 +2,22 @@ # Add a new script newscript() { - file="$HOME/.scripts/$1" - [ -f "$file" ] && { - echo "Script with the same name already exists, exiting" >&2 - exit 1 - } - touch "$file" && printf "#!/bin/sh\n\n" >"$file" && "$EDITOR" +2 "$file" - if [ "$(wc -l "$file" | awk '{print $1}')" -lt 3 ]; then - rm -f "$file" - else - chmod +x "$file" - fi + file="$HOME/.scripts/$1" + [ -f "$file" ] && { + echo "Script with the same name already exists, exiting" >&2 + exit 1 + } + touch "$file" && printf "#!/bin/sh\n\n" >"$file" && "$EDITOR" +2 "$file" + if [ "$(wc -l "$file" | awk '{print $1}')" -lt 3 ]; then + rm -f "$file" + else + chmod +x "$file" + fi } [ "$#" -ne 1 ] && { - echo "Usage: newscript <script-name>" >&2 - exit 1 + echo "Usage: newscript <script-name>" >&2 + exit 1 } newscript "$1" |
