Sponsored Content
Top Forums Shell Programming and Scripting Arithmetic calculation on real numbers in Bourne Shell Script Post 302435524 by Tirmazi on Wednesday 7th of July 2010 03:11:56 PM
Old 07-07-2010
It works when I copied the entire script, may be I had left someting.
Great Thanks

And the following method works too

Quote:
sav=`expr \( $per \* $price \) / 100 `
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Bourne shell script need help please ?

i have this assignment.. and i mad this script but there is something wrong with it.. if anyone can tell me.. watz going on... i would appreciate it.. tHnX in advance.. count=1 val=$2 op=$1 ans=0 if then if then while do ... (7 Replies)
Discussion started by: dezithug
7 Replies

2. UNIX for Dummies Questions & Answers

Bourne Shell Script

Hello, I'm throwing this out there as a novice to the Unix world...I've been working on a project that requires me to ouput (using the echo command) a list of names in a single column format, but the problem is the input is in row format followed by a blank space...If anyone could give me a... (2 Replies)
Discussion started by: dmhonor914
2 Replies

3. Shell Programming and Scripting

cd from a Bourne Shell Script - Please Help

Dear Bourne Shell Expert, I am trying to change the current working directory from within a Bourne Shell script. Simply enough i thought ! As I am sure you are well aware, Inside the script i echo `pwd` and it seems ok, but the shell spawns another shell to execute this and as such, when my... (10 Replies)
Discussion started by: fawqati
10 Replies

4. Shell Programming and Scripting

calculation using awk or shell script in between the numbers

file A E969K D223L E400L E34L file B predicted 3 1 250 251 500 501 1000 The output should be E969K 501 1000 D223L 1 250 E400L 251 500 E34L 1 250 I tried in this way (1 Reply)
Discussion started by: cdfd123
1 Replies

5. Programming

arithmetic calculation using awk

hi there again, i need to do a simple division with my data with a number of rows. i think i wanted to have a simple output like this one: col1 col2 col3 val1 val2 val1/val2 valn valm valn/valm any suggestion is very much appreciated. thanks much. (2 Replies)
Discussion started by: ida1215
2 Replies

6. Shell Programming and Scripting

how to do decimal arithmetic in shell script

hi, I have a file with decimal/non-decimal values $ cat b22 373 164 92 62 20 131 94 12 129 111 95 154 37 15 447 25 7.4 135 77 122 32 92 70 57 37 42 72 17 13 97 40 41 53 22 80 71 29 87 23 31 273 6.2 12K 43 44 45 22 11 7.7 13 18 173 36 20 18 13 56 67 104 53 5.4 241 19 13 3.8 38 14 31 329 16 155... (8 Replies)
Discussion started by: sam05121988
8 Replies

7. Shell Programming and Scripting

Help with Arithmetic calculations in Shell script

Hi, I need a help with arithmetic calculations in my script. I have two variables: a=17; b=1712 I want to perform ($a/$b)*100 with two decimals in the result. I tried with following: res=$((100*a/b)) res=`echo "scale=2; $a / $b" | bc` But I am not getting the decimal values.... (4 Replies)
Discussion started by: karumudi7
4 Replies

8. Shell Programming and Scripting

Arithmetic calculation in variable

Hi, I am trying to do an addition to a value stored in a variable... var1=`grep -n "match" sample.txt|cut -d : -f1` var2=`echo $var1|cut -d " " -f1` (Here i want add +1 to the output value) (4 Replies)
Discussion started by: Kevin Tivoli
4 Replies

9. Shell Programming and Scripting

Adding (as in arithmetic) to numbers in columns in file, and writing new file with new numbers

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

BC calculation for floating (invalid arithmetic operator )

Hi, I wish to compare the CPU LOAD 1 min with 5mins and 15mins. If 1 min's CPU LOAd spike 3% compare to 5 mins or 15 mins CPU Load, it is warning. If 1 min's CPU LOAd spike 5% compare to 5 mins or 15 mins CPU Load, it is critical. However I received following code error, I google it and... (10 Replies)
Discussion started by: alvintiow
10 Replies
SWFACTION(3)								 1							      SWFACTION(3)

The SWFAction class

INTRODUCTION
SWFAction. CLASS SYNOPSIS
SWFAction SWFAction Methods o SWFAction::__construct (string $script) DESCRIPTION
The script syntax is based on the C language, but with a lot taken out- the SWF bytecode machine is just too simpleminded to do a lot of things we might like. For instance, we can't implement function calls without a tremendous amount of hackery because the jump bytecode has a hardcoded offset value. No pushing your calling address to the stack and returning- every function would have to know exactly where to return to. So what's left? The compiler recognises the following tokens: o break o for o continue o if o else o do o while There is no typed data; all values in the SWF action machine are stored as strings. The following functions can be used in expressions: o time() - Returns the number of milliseconds (?) elapsed since the movie started. o random(seed) - Returns a pseudo-random number in the range 0-seed. o length(expr) - Returns the length of the given expression. o int(number) - Returns the given number rounded down to the nearest integer. o concat(expr, expr) - Returns the concatenation of the given expressions. o ord(expr) - Returns the ASCII code for the given character o chr(num) - Returns the character for the given ASCII code o substr(string, location, length) - Returns the substring of length $length at location $location of the given string $string. Additionally, the following commands may be used: o duplicateClip(clip, name, depth) - Duplicate the named movie $clip (aka sprite). The new movie clip has name $name and is at depth $depth. o removeClip(expr) - Removes the named movie clip. o trace(expr) - Write the given expression to the trace log. Doubtful that the browser plugin does anything with this. o startDrag(target, lock, [left, top, right, bottom]) - Start dragging the movie clip $target. The $lock argument indicates whether to lock the mouse (?)- use 0 ( FALSE) or 1 ( TRUE). Optional parameters define a bounding area for the dragging. o stopDrag() - Stop dragging my heart around. And this movie clip, too. o callFrame(expr) - Call the named frame as a function. o getURL(url, target, [method]) - Load the given URL into the named target. The $target argument corresponds to HTML document targets (such as "_top" or "_blank"). The optional $method argument can be POST or GET if you want to submit variables back to the server. o loadMovie(url, target) - Load the given URL into the named target. The $target argument can be a frame name (I think), or one of the magical values "_level0" (replaces current movie) or "_level1" (loads new movie on top of current movie). o nextFrame() - Go to the next frame. o prevFrame() - Go to the last (or, rather, previous) frame. o play() - Start playing the movie. o stop() - Stop playing the movie. o toggleQuality() - Toggle between high and low quality. o stopSounds() - Stop playing all sounds. o gotoFrame(num) - Go to frame number $num. Frame numbers start at 0. o gotoFrame(name) - Go to the frame named $name. Which does a lot of good, since I haven't added frame labels yet. o setTarget(expr) - Sets the context for action. Or so they say- I really have no idea what this does. And there's one weird extra thing. The expression frameLoaded(num) can be used in if statements and while loops to check if the given frame number has been loaded yet. Well, it's supposed to, anyway, but I've never tested it and I seriously doubt it actually works. You can just use /:framesLoaded instead. Movie clips (all together now- aka sprites) have properties. You can read all of them (or can you?), you can set some of them, and here they are: o x o y o xScale o yScale o currentFrame - (read-only) o totalFrames - (read-only) o alpha - transparency level o visible - 1=on, 0=off (?) o width - (read-only) o height - (read-only) o rotation o target - (read-only) (???) o framesLoaded - (read-only) o name o dropTarget - (read-only) (???) o url - (read-only) (???) o highQuality - 1=high, 0=low (?) o focusRect - (???) o soundBufTime - (???) So, setting a sprite's x position is as simple as /box.x = 100;. Why the slash in front of the box, though? That's how flash keeps track of the sprites in the movie, just like a Unix filesystem- here it shows that box is at the top level. If the sprite named box had another sprite named biff inside of it, you'd set its x position with /box/biff.x = 100;. At least, I think so; correct me if I'm wrong here. PHP Documentation Group SWFACTION(3)
All times are GMT -4. The time now is 08:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy