#!/usr/bin/env bash # -*-coding:utf-8 -*- # Auto updated? # Yes #File : # makebash #Author: # The-Repo-Club [wayne6324@gmail.com] #Github: # https://github.com/The-Repo-Club/ # # Created: # Wed 19 January 2022, 05:34:21 PM [GMT] # Modified: # Fri 21 January 2022, 02:29:56 PM [GMT] # # Description: # # Err(){ printf '%s\n' "$2" 1>&2 [ $1 -gt 0 ] && exit $1 } while [ "$1" ]; do case $1 in --repo|-r) Repo=$2 shift;; --file|-f) File=$2 shift;; -*) Err 1 'Incorrect option(s) specified.' ;; *) break ;; esac shift done [ -z "$Repo" ] && Err 1 'Missing repo' [ -z "$File" ] && Err 1 'Missing file' [ -f "$File" ] && Err 1 'File already exists' Date=$(date) cat << EOF > "$File" #!/usr/bin/env bash # Path - /usr/bin/$File # Author - The-Repo-Club [wayne6324@gmail.com] # Github - https://github.com/The-Repo-Club/$Repo # Start on - $Date # Modified on - $Date EOF printf "%s/%s has been created!\n" "$(pwd)" "$File"