diff options
author | Timmy Keller <tjk@tjkeller.xyz> | 2021-09-11 00:36:13 -0500 |
---|---|---|
committer | Timmy Keller <tjk@tjkeller.xyz> | 2021-09-11 00:36:13 -0500 |
commit | 0a9053c2902adab8b94eaacdb15390441143078c (patch) | |
tree | 1f1a38272dbd554cde8cdec263187112b9c6a7e8 /misc/mksh | |
download | scripts-0a9053c2902adab8b94eaacdb15390441143078c.tar.xz scripts-0a9053c2902adab8b94eaacdb15390441143078c.zip |
redid repo cus of fucking chromium rip old commit messages
Diffstat (limited to 'misc/mksh')
-rwxr-xr-x | misc/mksh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/misc/mksh b/misc/mksh new file mode 100755 index 0000000..6b43300 --- /dev/null +++ b/misc/mksh @@ -0,0 +1,11 @@ +#!/bin/sh +# Sorry in advance to 'mksh' users (users of the shell, not this script) +newname() { defname="script"; name=$defname`ls | grep "^$defname[0-9]*" | wc -l | tr -d '[:blank:]'`; } # Remove blank space for certain non-GNU wc implementations +[ -z "$1" ] && newname || name="$1" +[ -z "$2" ] && shebang="#!/bin/sh" || shebang="$2" +touch "$name" +echo "$shebang" > "$name" +chmod +x "$name" +$EDITOR "$name" || vim "$name" +# Delete file if it is just exited w/o being changed +[ "`cat "$name"`" = "$shebang" ] && rm "$name" && echo "Removed empty script \"$name\"" || echo "Saved script \"$name\"" |