summaryrefslogtreecommitdiff
path: root/newscript
diff options
context:
space:
mode:
authorfilip <“filip.rabiega@gmail.com”>2026-01-21 23:42:15 +0100
committerfilip <“filip.rabiega@gmail.com”>2026-01-21 23:42:15 +0100
commit17df35dc088c9b1b159c2b78d8330fa9cc9a672a (patch)
tree052205953f7f11a9ea847a9b4d238f6acdbc25b8 /newscript
parentd127601c83c1a30063b76eb89bf0d9a32ed435b9 (diff)
downloadchadscripts-17df35dc088c9b1b159c2b78d8330fa9cc9a672a.tar.gz
chadscripts-17df35dc088c9b1b159c2b78d8330fa9cc9a672a.tar.bz2
chadscripts-17df35dc088c9b1b159c2b78d8330fa9cc9a672a.zip
reformat most scripts
Diffstat (limited to 'newscript')
-rwxr-xr-xnewscript26
1 files changed, 13 insertions, 13 deletions
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 <script-name>" >&2
- exit 1
+ echo "Usage: newscript <script-name>" >&2
+ exit 1
}
newscript "$1"