Calculator Program in Linux

2,587

5

Introduction: Calculator Program in Linux

Its a simple calculator program for beginners in Linux,

Step 1: Things Required

1. Laptop or Desktop

2. Linux OS (I Prefer Fedora)

3. NormalBrain

Step 2: Program

case $1 in

"add") echo "sum $2 $3:`expr $2 + $3`"

;;

"sub") echo "diff $2 $3:`expr $2 - $3`"

;;

"mul") echo "mul $2 $3:`expr $2 \* $3`"

;;

"div") echo "div $2 $3:`expr $2 \/ $3`"

;;

esac

Step 3: How to Begin

1. Open the Gedit Text Editor {Applications -> Accessories -> Gedit text editor}

2. Type the program and save it as in ‘ .sh ’ format (.sh means Shell Script}ShellScripting

3. Save the program in Desktop or any other folders

4. Go to Command prompt and type 'SU' for accessing Root Server

5. Enter Your Login Password and Go to your Program Folder ,where we saved our calculator program {you can use 'cd' command for changing directory.'cd..' for Going back to the previous directory and use 'ls' for seeing the list of directories}

6. call your program by using ' ./ ' name of the program

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    Discussions