Command line arguments in Shell Script
This shell script shows how to accept command line arguments in shell scripts. In this example it accepts two numbers and adds them.
Read tutorialTHE TUTORIAL LIBRARY
This shell script shows how to accept command line arguments in shell scripts. In this example it accepts two numbers and adds them.
Read tutorialThis shell script demonstrates the use of arrays with a script that sorts 5 numbers and prints the sorted numbers.
Read tutorialThis shell script accepts a year and checks if the entered year is leap year or not.
Read tutorialThis shell script shows to print any one of the following message in infobox using dialog utility, if installed in your system, If dialog utility is not installed then use echo sta
Read tutorialThis shell script prints contents of file from given line number to next given number of lines. For e.g. If we called this script as printfile and run as $ printfile 5 5 myfile , H
Read tutorialThis shell script prints the given number's sum of all digits, For eg. If no is 123 it's sum of all digit will be 1+2+3 = 6.
Read tutorialWhile programming shell sometimes you need to find the errors (bugs) in shell script and correct the errors (remove errors - debug). For this purpose you can use -v and -x option w
Read tutorialThe case statement is good alternative to Multilevel if-then-else-fi statement. It enable you to match several values against one variable. Its easier to read and write.
Read tutorialLoop is executed as long as given condition is true. For e.g..>the for loop program can be written using while loop as:
Read tutorialAs you see the if statement can nested, similarly loop statement can be nested. You can nest the for loop. To understand the nesting of for loop see the following shell script.
Read tutorialThe for loop first creates i variable and assigned a number to i from the list of number from 1 to 5, The shell execute echo statement for each assignment of i. (This is usually kn
Read tutorialAbove program gives error for last run, here integer comparison is expected therefore error like "./elf: [: -gt: unary operator expected" occurs, but still our program notify this
Read tutorialOne example today. A better developer tomorrow.