Tag Archives: hello

Bash Programming : Say user hello !

Take a name from user and say hello user! 😀

 

Bash Programming : Check typed name is a valid $USER or not

I tried it hardly….Here you have to maintain the syntax

if[expression]
then
echo expr ""Hello Name
fi

and this conditional

if [ “foo” = “foo” ]; then
echo expression evaluated as true
fi

or the same things can be written as

if[ “foo” = “foo” ]
then
echo expr "Hello !"
fi

if..then..else in bash

if [ “zaki” = “live” ]
then
echo expr "True !"
else echo
expr “False!”

conditional with variables
t1="zaki"
t2="live"
if [ "$t1" = "t2" ]
then
echo
expr “True”
else
echo
expr “False”`
fi #you have to end with this if you started with if

Reference: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-6.html#ss6.1
http://ryanstutorials.net/bash-scripting-tutorial/bash-if-statements.php