#! /bin/bash
################################################
##Author: freeking
##Created: July 28th 2013
##Description replace the word u want
################################################
var1="hello"
var2=
var3=
echo ${var1}
echo ${var2:-world} #if var2 exist and equal null return world
echo ${var2} #but var2 still equal null
#if var2 exist and equal null put "world" to var2
echo ${var2:=world}
#if var3 exist and equal null put the next message
#catch the error for the undefine parameters
echo ${var1:?"the var3 is null"}
#echo ${var3:?"the var3 is null"}
#if var3 exist and equal null put the next message
echo ${var1:+2}
echo ${var3:+2}
################################################
##Author: freeking
##Created: July 28th 2013
##Description replace the word u want
################################################
var1="hello"
var2=
var3=
echo ${var1}
echo ${var2:-world} #if var2 exist and equal null return world
echo ${var2} #but var2 still equal null
#if var2 exist and equal null put "world" to var2
echo ${var2:=world}
#if var3 exist and equal null put the next message
#catch the error for the undefine parameters
echo ${var1:?"the var3 is null"}
#echo ${var3:?"the var3 is null"}
#if var3 exist and equal null put the next message
echo ${var1:+2}
echo ${var3:+2}