NAME="Tamil Medium" echo ${NAME/Tamil/English} echo ${NAME: -6} echo ${#NAME} NEWNAME="kavi" echo ${NEWNAME} echo ${Foo:-"default value is empty"} echo `ls` echo `echo \`ls\`` echo $(echo $(ls)) DATE="$(date)" echo $DATE NAME="elamathi" echo ${NAME/e/E} echo ${NAME:0:3} echo ${NAME::4} echo ${NAME::-2} echo ${NAME:(-5)} echo ${NAME:(-3)} NAME="Tamil era Tamil Tutorial" echo ${NAME//Tamil/English} STR="Hello ALL" echo ${STR,} echo ${STR,,} CHAR="elephant" echo ${CHAR^} echo ${CHAR^^} STRING="kavi" if [ -z "$STRING" ] then echo "string is empty" elif [ -n "$STRING"] then echo "string is not empty" else echo "not happened" fi
Write, Run & Share Bash code online using OneCompiler's Online Bash Shell for free. It's one of the robust, feature-rich Bash shell available over online and getting started with the OneCompiler's Bash Shell is simple and pretty fast. The editor shows sample boilerplate code when you choose language as Bash
. OneCompiler also has reference scripts, where you can look for the sample scripts and start coding.
Bash (Bourne Again Shell) is a shell program written by Brian Fox and is an upgraded version of Bourne Shell program 'sh'.
name="Foo"
echo $name
echo "$name"
echo "${name}"
if [ conditional-expression ]
then
statements
fi
if [ conditional-expression ]
then
statements
else
statements
fi
if [ conditional-expression ]
then
statements
elif [ conditional-expression ]
then
statements
else
statements
fi