summaryrefslogtreecommitdiff
path: root/newscript
diff options
context:
space:
mode:
authorfilip <“filip.rabiega@gmail.com”>2026-01-18 11:44:26 +0100
committerfilip <“filip.rabiega@gmail.com”>2026-01-18 11:44:26 +0100
commit83954961af8b6337da100e038561f2fd975ac1fe (patch)
tree33a45dbf91cc4c0b8975287b9537db8aa272505f /newscript
parentafd02bfcce54e3252d356f34c25a155c855f3612 (diff)
downloadchadscripts-83954961af8b6337da100e038561f2fd975ac1fe.tar.gz
chadscripts-83954961af8b6337da100e038561f2fd975ac1fe.tar.bz2
chadscripts-83954961af8b6337da100e038561f2fd975ac1fe.zip
huge changesHEADmaster
Diffstat (limited to 'newscript')
-rwxr-xr-xnewscript26
1 files changed, 13 insertions, 13 deletions
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 <script-name>" >&2
- exit 1
+ echo "Usage: newscript <script-name>" >&2
+ exit 1
}
newscript "$1"