shell script that adds two integers and display answer on screen


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shell script that adds two integers and display answer on screen
# 1  
Old 07-04-2008
shell script that adds two integers and display answer on screen

please help
shell script that adds two intergers and display answer on screen
# 2  
Old 07-04-2008
Quote:
Originally Posted by wanyac2
please help
shell script that adds two intergers and display answer on screen
Code:
#!/usr/bin/ksh

sum=`expr $1 + $2`
echo " the sum of the values is $sum"
namish@france => ./sample1 10 20
30

thanks
Namish
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need some help in formatting answer of shell script

Dear all, I am new to shell scripting and have tried to make a small program for fun sake that tells age from the last number of cell phone and birth year. At the end we get a final 3 digit number and the first digit represents the last digit of cell phone and rest 2 numbers shows age. eg. 423... (4 Replies)
Discussion started by: stg44
4 Replies

2. Shell Programming and Scripting

Grep float/integers but skip some integers

Hi, I am working in bash in Mac OSX, I have following 'input.txt' file: <INFO> HypoTestTool: >>> Done running HypoTestInverter on the workspace combined <INFO> HypoTestTool: The computed upper limit is: 11 +/- 1.02651 <INFO> HypoTestTool: expected limit (median) 11 <INFO> HypoTestTool: ... (13 Replies)
Discussion started by: Asif Siddique
13 Replies

3. Shell Programming and Scripting

Run a bash script, display on the screen and save all information in a file including error info

Hi all, How to: Run a bash script, display on the screen and save all information in a file including error information. For example: I have a bash script called test.sh now I want to run the test.sh and display the output on the screen and save the output including error info to a file. ... (1 Reply)
Discussion started by: Damon sine
1 Replies

4. Shell Programming and Scripting

Editing lists of integers in 1d files with bash shell

Hi, I need a script that will: 1. Go through about 20 different folders, each containing about 20 1d files. The 1d files go something like this: 22.253 37.707 78.117 112.374 127.944 156.067 180.956 233.785 249.256 ... (1 Reply)
Discussion started by: ac130pilot
1 Replies

5. Shell Programming and Scripting

Passing Integers to shell script from java

i have to pass an integer value to shell script which will mail the values to users. I am able to pass string values like this. try { String strCmdToRun1 = new String { "sh", "mail.sh","hello"}; Process p1 = rtime.exec(strCmdToRun1); BufferedReader output... (1 Reply)
Discussion started by: naveensraj
1 Replies

6. Shell Programming and Scripting

Answer Terminal Questions With Shell Script?

First off, I am using Mac OS X, with Apple Remote Desktop. I have to install several app's on teachers' laptops which are on several cd's that I have made disk images of. (DMG's) To do rollouts quicker, I have written a script to mount the disk images and running the installers inside each of... (4 Replies)
Discussion started by: The Reepr
4 Replies

7. Shell Programming and Scripting

Shell script answer prompts?

Hi, I'm writing a script that calls a function to generate a certificate. In generating this certificate, I'm asked a series of questions. I was wondering, is there a way to pre-program my script to answer these questions in the same way all the time. I saw something like EOF>> y EOF ... (4 Replies)
Discussion started by: eltinator
4 Replies

8. Shell Programming and Scripting

screen display help

Hello All, I have a file that is formatted like this 1234556 1234567 1234588 1123888 1999999 1010101 1919191 1919191.... for a total of 26000 + lines how do I get a script to read lets say 50 lines at a time and display the output to the screen in column format around 5 or 6... (2 Replies)
Discussion started by: zilla30066
2 Replies

9. UNIX for Dummies Questions & Answers

how do you represent non integers in a shell script?

am trying to write a script that test that the load average which is taken from the uptime command's output to make sure it doesn't pass a certain limit. each time I execute the script, it complains about interger errors. if (2 Replies)
Discussion started by: TRUEST
2 Replies

10. Shell Programming and Scripting

Simple Perl Script to Screen Display

$number_clients++; print("Creating client $number_clients\r"); I have been using the above to increment on the screen as the script increments throughout a while loop. What I would like to know is what is the trick to keep the last one on the screen without printing it again? Ie ... (1 Reply)
Discussion started by: Shakey21
1 Replies
Login or Register to Ask a Question