summaryrefslogtreecommitdiff
path: root/bin/common/toush
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-04 22:45:56 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-04 22:45:56 +0200
commit1914d16f1693a3c31f8ad9e07b1469df1604d690 (patch)
treea8a623823adc077f7371de379b9e70eb7a7b485c /bin/common/toush
parent49bbf6906089b5d957e2a781002d32b811ae630d (diff)
parente850f3a1702b4d8b9d0cfec5c07d710b5201ed29 (diff)
Merge branch 'main' of /var/git/dotfiles
Diffstat (limited to 'bin/common/toush')
-rwxr-xr-xbin/common/toush10
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/common/toush b/bin/common/toush
new file mode 100755
index 0000000..eb2d7cf
--- /dev/null
+++ b/bin/common/toush
@@ -0,0 +1,10 @@
+#!/bin/sh
+# idea from https://codeberg.org/futxlii/bin/toush :)
+
+shebang='#!/bin/sh'
+
+[ -f "$1" ] && exit 1
+
+printf '%s\n\n' "$shebang" > "$1" &&
+ chmod +x "$1" && $EDITOR "$1"
+grep -qv "$shebang\|^$" "$1" || rm "$1"