From 83954961af8b6337da100e038561f2fd975ac1fe Mon Sep 17 00:00:00 2001 From: filip <“filip.rabiega@gmail.com”> Date: Sun, 18 Jan 2026 11:44:26 +0100 Subject: huge changes --- newscript | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'newscript') diff --git a/newscript b/newscript index f6d11b0..154d2fb 100755 --- a/newscript +++ b/newscript @@ -1,22 +1,22 @@ #!/bin/sh 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