#!
#
#!/bin/bash
# declare STRING variable
STRING="Hello World"
#print variable on a screen
echo $STRING
$ chmod +x hello_world.sh
./hello_world.sh
#!/bin/bash
LO=myhome_directory_$(date +%Y%m%d).tar.gz
tar -czf $LO /home/important
without back-ticks, just echoing happens. Use back-tics to pass commands that you'll type in the terminal
echo `uname -o`
echo -e "Type the word"
read word
echo "The word you entered is: $word"
use \"hello\" if you want to print "hello". \" is escape for ".
read
using just read reads input to the default variable $REPLY
read -a myarray
using -a reads input to a myarray variable. Retrieve stored values using
${myarray[0]}, ${myarray[1]}, etc.
[1] "Bash Scripting Tutorial", <http://www.linuxconfig.org/Bash_scripting_Tutorial>, retrieved May 11, 2011.