11-17-2009
thank you, however I have tried that method using code similar to:
for a in $*
do
total=`expr $sum + a`
echo "$total"
done
is this what you meant? If so then I have found it delivers the following output:
./sum 2 4 5 5 12 //user has entered 5 numbers
11 //sum of the first three
16 //sum of the first three plus the fourth
23 //sum of the first three plus the fifth
as you can see it does the usual 'sum' equation then adds each value to the first 3 individually. I need them all to be totalled. Any ideas?
Thank you again
-James
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I would like to write a script with BASH to add two numbers (integer) and write the result to the standard output. Please help! (7 Replies)
Discussion started by: Viper01
7 Replies
2. Shell Programming and Scripting
how to add 2 float values to each other?
i tried this and it doesnt work:
#!bin/bash
numone=1.234
numtwo=0.124
total=`expr $numone + $numtwo`
echo $total
thanks (5 Replies)
Discussion started by: strike
5 Replies
3. UNIX for Dummies Questions & Answers
hi everyone, i need help with writing a program that adds three numbers together in unix. (1 Reply)
Discussion started by: dynastie
1 Replies
4. Shell Programming and Scripting
i have a list of numbers like this;
124
235
764
782
765
451
983
909
...
and i want to make a sum with the first 3 of them then the next 3 and so on.
124+235+764=1123
782+765+451=1998
...
some ideas? (4 Replies)
Discussion started by: Tártaro
4 Replies
5. Shell Programming and Scripting
Hi
I figured how to add my list of numbers. However how do I count so that after a certain number it lists the line.
Example:
12 test1
46 test2
195 test3
174 test4
634 test5
185 test6
94 test7
So basically add the numbers and when the addition reaches 300 or less
print the... (8 Replies)
Discussion started by: bombcan
8 Replies
6. Shell Programming and Scripting
I am writing a bash script on ubuntu11.10
I have some string having numbers and letter and want to add all the numbers together
For example
1s2d23f
I want to perform
1 + 2 + 23 and store it in a variable (3 Replies)
Discussion started by: kristinu
3 Replies
7. Shell Programming and Scripting
I have a file which has following contents which I want to add up.
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
139038.72
139038.72
139038.72
139038.72 (5 Replies)
Discussion started by: aksijain
5 Replies
8. UNIX for Dummies Questions & Answers
Hello. Trying to add a column of numbers and combine the 1st and 2nd fields as uniq with the new total.
This works to add the numbers but can't figure an easy was to combine the 1st and 2nd column as the list is very long. awk '{s+=$3} END {print s}'
bird dog 300
bird dog 100
cat clown 200... (1 Reply)
Discussion started by: jimmyf
1 Replies
9. Shell Programming and Scripting
Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do.
I have a file which is formatted as... (4 Replies)
Discussion started by: crunchgargoyle
4 Replies
10. Shell Programming and Scripting
Hi All,
Could you please help me on this requirement.
File data:
A
A
A
B
B
B
i need the output like
A1
A2
A3
B1 (3 Replies)
Discussion started by: bmk123
3 Replies
LEARN ABOUT LINUX
debconf
DEBCONF(1) Debconf DEBCONF(1)
NAME
debconf - run a debconf-using program
SYNOPSIS
debconf [options] command [args]
DESCRIPTION
Debconf is a configuration system for Debian packages. For a debconf overview and documentation for sysadmins, see debconf(7) (in the
debconf-doc package).
The debconf program runs a program under debconf's control, setting it up to talk with debconf on stdio. The program's output is expected
to be debconf protocol commands, and it is expected to read result codes on stdin. See debconf-devel(7) for details about the debconf
protocol.
The command to be run under debconf must be specified in a way that will let your PATH find it.
This command is not the usual way that debconf is used. It's more typical for debconf to be used via dpkg-preconfigure(8) or
dpkg-reconfigure(8).
OPTIONS
-opackage, --owner=package
Tell debconf what package the command it is running is a part of. This is necessary to get ownership of registered questions right, and
to support unregister and purge commands properly.
-ftype, --frontend=type
Select the frontend to use.
-pvalue, --priority=value
Specify the minimum priority of question that will be displayed.
--terse
Enables terse output mode. This affects only some frontends.
EXAMPLES
To debug a shell script that uses debconf, you might use:
DEBCONF_DEBUG=developer debconf my-shell-prog
Or, you might use this:
debconf --frontend=readline sh -x my-shell-prog
SEE ALSO
debconf-devel(7), debconf(7)
AUTHOR
Joey Hess <joeyh@debian.org>
2011-06-22 DEBCONF(1)