Похожие чаты

I am experimenting stuff in Glitch about my first CLI

written in pure Bash without any crappy packages or random JS code. As I run some tests, the errors echoes around the console. Any solution?

1 ответов

7 просмотров

bash #!/bin/bash #Set name NAME=$(basename $0) ## Commands Stuff HELP_COMMAND="help" #This is how to use the script usage=" Bash Script Samples v0.1.0-alpha by the Pins team Hello. The Bash Script Samples was built by the Pins team to automate your tasks without manually typing commands. Usage: ${NAME} [OPTIONS] [ARGS] Available CLI options are: help Show this help message. git-clone Clone the full Git repository from GitLab mirror. update-cli Update the CLI code. This will download and run the script updater. version Prints th version of the CLI. Available global CLI arguments are: -h, --help Show help for this option, otherwise fall backs to this message. --version, -v Same as the "version" command. " #Run script #Show help based on selection if [ ${PUSAGE} ]; then echo "${usage}" exit 0 elif [ $1 = "help" ]; then echo "${usage}" exit 0 elif [ $1 = "-h" ]; then echo "${usage}" exit 0 elif [ $1 = "--help" ]; then echo "${usage}" exit 0 fi # Check for input if none show help. if [[ $1 == "" ]]; then echo "[INFO] Sent a blank command. Try using 'help' instead." exit 0 fi

Похожие вопросы

Обсуждают сегодня

Карта сайта