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 02:03 AM
Bash: how to do it? sopel39 Shell Programming and Scripting 3 11-02-2007 12:35 AM
Bash it! Bash it! SoulForge Shell Programming and Scripting 5 11-22-2002 09:02 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
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 (permalink)  
Old 06-11-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,493
bash v 2.02 & up has the ** operator which is exponentiation
Code:
i=2
var=2**(5+$i)
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:22 PM.


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

Content Relevant URLs by vBSEO 3.2.0