The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
passing variable from bash to perl from bash script arsidh Shell Programming and Scripting 10 06-04-2008 09:25 AM
Why generate "ash and bash" different output for same bash script? s. murat Shell Programming and Scripting 0 05-26-2008 04:19 AM
Bash under AIX 5.3 taupin AIX 4 03-21-2008 03:03 AM
Bash: how to do it? sopel39 Shell Programming and Scripting 3 11-02-2007 01:35 AM
Bash it! Bash it! SoulForge Shell Programming and Scripting 5 11-22-2002 10:02 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-11-2008
Registered User
 

Join Date: Jun 2007
Posts: 16
Bash squares and exponents

I'm trying to write a simple bash script and I need something like
var=2^(5+i)
where i is another variable. How would do I this in bash?
Reply With Quote
Forum Sponsor
  #2  
Old 06-11-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
bash v 2.02 & up has the ** operator which is exponentiation
Code:
i=2
var=2**(5+$i)
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:26 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0