#!/bin/bash echo "Hello World!" # print a string echo "Welcome $USER" # print a variable value echo '$USER' # single quote does not interpret the variable echo "Today is $(date)" # print the output of a command echo -e "Number of user login: \c"; who | wc -l # \c keeps the cursor on the same line after the end of the echo, need -e to enable it echo -e "Hello\n World!" # \n, newline echo -e The gif files are *.sh # wildcard exit 0 # 0 represent the program is implemented successfully
#!/bin/bash printf "Hello %s\n" $USER printf "Hello |%10s|\n" $USER printf "Hello |%-10s|\n" $USER printf "Value of PI is: %10.2f\n" 3.1415926