![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sed to grep only numbers in string | ajilesh | Shell Programming and Scripting | 5 | 11-07-2008 01:39 PM |
| How to sort a string with numbers | ahjiefreak | Shell Programming and Scripting | 5 | 12-21-2007 10:52 AM |
| How to Compare Floating point / real numbers | padarthy | Shell Programming and Scripting | 13 | 09-24-2007 08:03 PM |
| How do i get numbers from a string? | eliraza6 | Shell Programming and Scripting | 13 | 07-18-2007 07:04 AM |
| problem with floating point numbers in awk | kanagias | Shell Programming and Scripting | 7 | 06-24-2005 03:14 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Using Floating Numbers in String
Dear Unix Gurus,
I have a list of files that I want to loop over....for example: Code:
sl40_z11.70.txt sl41_z11.40.txt sl42_z11.10.txt sl43_z10.80.txt Code:
#!/bin/sh # echo -n "....enter first Z-coordinate position....."; read zpos q="scale=3; $zpos" p=0.3 # loopNumber=$[($lastslice - $firstslice)+1] echo "loopNumber is $loopNumber" echo firstslice no. is $firstslice for ((i=$firstslice; i<=$loopNumber; i++)); do n=$[i] for ((k=0; k<=$loopNumber; k++)); do r=$[k] ; f=$r*$p ; zposition=$q-$f echo "sl$[n]_z$[zposition].txt" done done My problem is that the script works fine with the exception that bash doesn't recognize $zposition. It apparently can't handle iteration with floating numbers? Can someone help? Cheers |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|