Calculator Program in Linux

Published

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

Share

    Recommendations

    • Creative Misuse Contest

      Creative Misuse Contest
    • Oil Contest

      Oil Contest
    • Water Contest

      Water Contest

    Discussions