ao-mud is a spellbook of well-commented atomic bash scripts that each do one thing. we are building semantic building blocks for an autonomously-evolving digital spellcasting language.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
1.4 KiB

# ao-bash Opinionated Code Style Guide
This script is a style guide for the ao-bash / ao-mud project and is not meant to be run. Please examine the file in a text editor.
# File Extensions
Name scripts in the ao-bash suite without the `.sh` file extension. (Reason: When folders of ao-bash spells are added to the $PATH directory, the scripts can simply be called by name, without having to type `.sh` every time.)
# How to print something to the terminal
`say` is an ao-bash command that uses printf to echo a line to a screen (it adds the \n to the end and thus functions like echo).
`printf` is preferred to `echo` because it is more cross-platform, however realistically echo will also be used and should also work in virtually all cases. Note that `printf` needs a \n explicitly at the end of the string, and also includes more advanced options for formatting variables that it displays.
# How to ask the user a question
`ask` is an ao-bash suite command that asks the user an open-ended question, and outputs their response (which can be saved in a variable). Use it like this:
```answer=ask "Please enter your name:"```
`ask_yn` is a similar command that takes a question, plus an optional second argument Y or N that defines the default response if the user presses Enter (if the second argument is not supplied, it defaults to N):
```ask_yn "Would you like a treatment?" Y```