diff options
author | Timmy Keller <tjk@tjkeller.xyz> | 2022-03-16 23:37:09 -0500 |
---|---|---|
committer | Timmy Keller <tjk@tjkeller.xyz> | 2022-03-16 23:37:09 -0500 |
commit | 3d3d79a57fb6d0a5728e0070475f05d1699f0818 (patch) | |
tree | b141cba678d6bb9821bb33b0dd7c7f1ca31b2c6a /misc/mksh | |
parent | d51fa1bdda79b8589ddf0002fc4b54aac6ce8354 (diff) | |
download | scripts-3d3d79a57fb6d0a5728e0070475f05d1699f0818.tar.xz scripts-3d3d79a57fb6d0a5728e0070475f05d1699f0818.zip |
move a lot of scripts around and make a bunch of minor changes. once again i am too lazy to document the changes properly since im never going to read these commit messages anyways
Diffstat (limited to 'misc/mksh')
-rwxr-xr-x | misc/mksh | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -3,7 +3,7 @@ newname() { defname="script"; name=$defname`ls | grep "^$defname[0-9]*" | wc -l | tr -d '[:blank:]'`; } # Remove blank space in certain non-GNU implementations of wc [ -z "$1" ] && newname || name="$1" [ -e "$name" ] && echo "File $name exists!" && exit 1 -[ -z "$2" ] && shebang="#!/bin/sh" || shebang="$2" -echo "$shebang" > "$name" && chmod +x "$name" && $EDITOR "$name" -# Delete file if it is just exited w/o being changed +[ -z "$2" ] && shebang="#!/bin/sh" || shebang="#!$2" +echo "$shebang" > "$name" && chmod +x "$name" && ${EDITOR:-vi} "$name" +# Delete file if it is empty [ "`cat "$name"`" = "$shebang" ] && rm "$name" && echo "Removed empty script \"$name\"" || echo "Saved script \"$name\"" |