Shell script to start learning.
#!/bin/bash if [ $UID -ne 0 ]; then echo "you are not root" else echo "you are root" fi var="hello world" echo $var echo ${var} echo "var is $var" echo 'var is $var' echo "length of var is ${#var}"
important point:
1. var = "hello world", with no spaces on both sides of the equal sign.
2. Invalid variable substitution in single quotes.
References:
"Linux Shell Scripting Raiders"
Reproduced in: https: //www.cnblogs.com/gattaca/p/6908278.html