diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-04 22:36:30 +0200 | 
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-04 22:36:30 +0200 | 
| commit | e850f3a1702b4d8b9d0cfec5c07d710b5201ed29 (patch) | |
| tree | d5857d46270af0577e071551d016dc3781dbe0bf | |
| parent | bdeda6f2ab14c58ffa83711415bc93474b2f77cb (diff) | |
edited toush to fit needs
| -rwxr-xr-x | bin/common/toush | 14 | 
1 files changed, 5 insertions, 9 deletions
diff --git a/bin/common/toush b/bin/common/toush index dd675b9..eb2d7cf 100755 --- a/bin/common/toush +++ b/bin/common/toush @@ -1,14 +1,10 @@  #!/bin/sh -# fork of -# https://codeberg.org/futxlii/bin/toush :) +# idea from https://codeberg.org/futxlii/bin/toush :)  shebang='#!/bin/sh' -usage() { >&2 printf 'Usage: %s' "${0##*/}"; exit 1 ;} +[ -f "$1" ] && exit 1 -[ "$1" ] || usage -while [ "$1" ]; do -	[ -f "$1" ] && usage -	printf '%s\n\n' "$shebang" > "$1" && chmod +x "$1" -	shift -done +printf '%s\n\n' "$shebang" > "$1" && +	chmod +x "$1" && $EDITOR "$1" +grep -qv "$shebang\|^$" "$1" || rm "$1"  | 
