Hey

Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2008
Posts: 10
Reputation: hjast is an unknown quantity at this point 
Solved Threads: 0
hjast hjast is offline Offline
Newbie Poster

Hey

 
0
  #1
Nov 13th, 2008
Shell Scripting Syntax (Toggle Plain Text)
  1. for (( i = 1 ; i <= 10; i++ ))
  2. do
  3. #J = 100
  4. echo `expr 1000 * $i`
  5. #java SortTester $num >> data.txt
  6. done

This is not working why?
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 399
Reputation: eggi will become famous soon enough eggi will become famous soon enough 
Solved Threads: 47
eggi eggi is offline Offline
Posting Whiz

Re: Hey

 
0
  #2
Nov 14th, 2008
Hey There,

You pretty much had it. You just need to backslash the * (multiplication operator) and your script works perfectly

Shell Scripting Syntax (Toggle Plain Text)
  1. #!/bin/bash
  2.  
  3. for (( i = 1 ; i <= 10; i++ ))
  4. do
  5. #J = 100
  6. echo `expr 1000 \* $i`
  7. #java SortTester $num >> data.txt
  8. done


$ ./script
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
Nice work

, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Shell Scripting
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC