bash scripting problem

Rob Harris robh at apearl.net
Sun Dec 2 07:30:08 UTC 2007


Now I've not tried this and it is years since I even tried; but - I didn't
know you could type an equation and get a result in a bash script line like
that.  But if you can, then you have to change which form of quoting
character you use which differentiates between quoting the term literally
like you got or forcing it to evaluate first.  Try  single '', double "" or
grarve accents ``.
----- Original Message ----- 
From: "Daniel Dalton" <daniel.dalton47 at gmail.com>
To: "Linux for blind general discussion" <blinux-list at redhat.com>;
<programming at blindprogramming.com>
Sent: Sunday, December 02, 2007 6:11 AM
Subject: bash scripting problem


Hi,

I am learning to shell script. One of my tasks is to print the value of
two numbers been added together. But first that final value must be
assigned to a variable.
So I write:
#!/bin/bash
#Print the value of 2 numbers added

x=10
y=15
z=$x+$y
echo $z
exit 0

I get 10 +15 as the output.

I want to get 25.
What am I doing wrong?
-- 
Daniel Dalton

http://members.iinet.net.au/~ddalton/
daniel.dalton47 at gmail.com

_______________________________________________
Blinux-list mailing list
Blinux-list at redhat.com
https://www.redhat.com/mailman/listinfo/blinux-list




More information about the Blinux-list mailing list