From 42a9aefb9420022079271be2798da5ae58f9165b Mon Sep 17 00:00:00 2001 From: ray Date: Mon, 17 Feb 2020 20:50:26 +0000 Subject: [PATCH] add newbash script --- README.md | 1 + src/newbash | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100755 src/newbash diff --git a/README.md b/README.md index 97ed77f..a640839 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,5 @@ Useful utility scripts. | Script | Comment | |---|---| |newsh ["command"]|Create executable `sh` script. Optionally add `command`.| +|newbash ["command"]|Create executable `bash` script. Optionally add `command`.| diff --git a/src/newbash b/src/newbash new file mode 100755 index 0000000..ca36360 --- /dev/null +++ b/src/newbash @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +if [ -f "$1" ] ; then + echo "Error: file exists: $1" + exit 1 +fi + +echo "#!/bin/bash" > "$1" +echo "" >> "$1" +echo "$2" >> "$1" + +chmod u+x "$1"