Running ways
- Make the shell script executable
- The script should begin with the shebang (e.g.
#!/bin/bash). - Treat the shell script as the argument of
sh - In this case, the shebang is not necessary.
echo
- By default, a line break is appended every time it is invoked.
- The default line break can be avoided by option
-n.
printf
- Syntax
printf "format_list" content/variable_listFormat
%s%3s: 3-character wide and right alignment.%-3s: 3-character wide and left alignment.
%c\n: line break.%f%5.2f: 5-character wide with 2 of them for decimal portion, right alignment.%-5.2f: 5-character wide with 2 of them for decimal portion, left alignment.