Shell Scripting Tutorial-28: 'if-then' Statement in Action

preview_player
Показать описание
In this tutorial you'll learn to use the 'if-then' statement to make decisions in shell programs.
Рекомендации по теме
Комментарии
Автор

Your new naming convention is appreciated! Thanks for keeping it 'human' =)

otawaaz
Автор

after if isnt a reverse quote needed to indicate that it needs to be executed and then the output has to be provided to the if

FoodieTravellers
Автор

I am a bit surprised when the command output is 0, then is executed. From C++ background, if the condition is boolean false or 0, it is skipped. In that situation you ave to handle the condition with == sign (ex if condition==false then do this) or if !condition then do this (here the condition is 0 or false)

MohammedRahman
Автор

#shell scripting on if-then statement
echo "Enter source and target filename"
read source target
mv $source $target
if [ $? -eq 0 ]
then
echo "Your file has been Successfully renamed"
fi




it works also

parthapratimsarkar
Автор

Hi, nice video, and also very clear the way you speak, thanks.I wish i can find them useful for me, i am currently trying to learn why my code i have is failing.I dont understand why my code if also different with the IF THEN statement.It also always has return code of 1 which i dont understand

CollosalTrollge
Автор

Thanks for posting such a wonderful tutorials in scripting.... do you have any sample scripts for reboot the server ....

jmanojkumar
Автор

I love your tutorials ! i have been scripting for a long time using google als my guide :)
Following your tutorials from vid 1 i am still learning new stuff .
very nice...
1 question remains... it it possible you put the scripts somehwere in the about statement ?
Just for reference..
Apart from that keep up the good work..
namaste !

Helldeskr
Автор

Thanks so much for the tutorials, but I'm using cygdrive (redhat) on windows 7, and there are such alot of commands that don't work and I get errors like this

Enter source and target file names
test newtest
': not a valid identifierrget
ss1.sh: line 7: syntax error near unexpected token `fi'
ss1.sh: line 7: `fi'

also the \n \r \t \b dont work, do you have any solution for this ??

MarwanGamalelGharably
Автор

font size very small...i dont see what u do..so waste video

mitsharma
join shbcf.ru