From 17df35dc088c9b1b159c2b78d8330fa9cc9a672a Mon Sep 17 00:00:00 2001 From: filip <“filip.rabiega@gmail.com”> Date: Wed, 21 Jan 2026 23:42:15 +0100 Subject: reformat most scripts --- newscript | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'newscript') diff --git a/newscript b/newscript index 87220ba..da2a21a 100755 --- a/newscript +++ b/newscript @@ -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 " >&2 - exit 1 + echo "Usage: newscript " >&2 + exit 1 } newscript "$1" -- cgit v1.2.3