mkdir country cd country pwd mkdir details; mkdir Shared; mkdir Mountains; ls; cd details; pwd; touch state.txt ls; echo " -------Write this content in state.txt------" echo "Punjab Tamilnadu delhi Meghalay Uttrakhand Haryana Delhi Assam Jharkhand Maharashtra Telengana haryana"> state.txt cat state.txt cd .. pwd cd Mountains; pwd; touch list.txt; ls; echo "------write this content in list list.txt-----" echo "Himalaya kamet Kangto Assam Himalaya Garhwal Himalaya Assam Himalaya Shahi kangri" > list.txt cat list.txt cd ../details pwd; cat state.txt | wc pwd cd ../ pwd cat details/state.txt | sort > Shared/sharedstate.txt cat Shared/sharedstate.txt; grep Haryana Shared/sharedstate.txt sed 's/Haryana/MP/' Shared/sharedstate.txt pwd grep -R "Assam" pwd ls cd Mountains ls sed -i 's/Assam/Sikkim/g' list.txt cat list.txt pwd cd ../Shared pwd cat sharedstate.txt cp sharedstate.txt States.txt cat States.txt
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