Ask a Question related to FreeBSD, Design and Development.
-
Scott Milliken #1
Re: How to handle numeric variables in sh?
Here's a code snippet of a script I use often to number a bunch of pics
in a directory that I think shows how to do what you want to do:
$PICNUM=100
for FNAME in DSC*.JPG
do
NEWNAME=My_Pictures-$PICNUM.jpg
mv $FNAME $NEWNAME
PICNUM=$(($PICNUM+1))
done
This works in /bin/sh from my FreeBSD 4.11 system and also bash. If you
want to perform a mathematical operation on a shell variable, just
surround the expression with $(( expr )) and it'll work.
Hope that helps.
Scott Milliken
Alejandro Pulver wrote:
>Hello,
>
>Is there a way to handle numeric variables (addition, multiplication, etc.) in 'sh' (or throught an external command)?
>
>Thanks and Best Regards,
>Ale
>_______________________________________________
>freebsd-questions@freebsd.org mailing list
>[url]http://lists.freebsd.org/mailman/listinfo/freebsd-questions[/url]
>To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
>
>!DSPAM:42176184998836675110134!
>
>
>Scott Milliken Guest
-
#39447 [NEW]: Want to optionally handle apc_upload_progress variables using session variables
From: krudtaa at yahoo dot com Operating system: All PHP version: 5.2.0 PHP Bug Type: Feature/Change Request Bug... -
Numeric stepper
I have a Numeric stepper & values are set as 1 min & 10000 max. The problem is - In the control if I clear the value (There is no value in the... -
JRun fails to handle client variables in DB over 8K
We are in the process of upgrading from CF 4.5 to CF MX 7. Our application uses client variables, which are configured to be stored in a SQL... -
how to handle 64 bit variables on 32 bit machines ?
Hi, I'd like to use the ruby/dl library to access function in a C library from ruby. Now these functions take 64 bit parameters und my machine... -
ViewState can't handle numeric fields?
If I do this x = 5 ViewState("myX") = x then after a post-back, ViewState("myX") is Nothing but this -
Alejandro Pulver #2
How to handle numeric variables in sh?
Hello,
Is there a way to handle numeric variables (addition, multiplication, etc.) in 'sh' (or throught an external command)?
Thanks and Best Regards,
Ale
Alejandro Pulver Guest
-
Eric Kjeldergaard #3
Re: How to handle numeric variables in sh?
On Sat, 19 Feb 2005 12:55:59 -0300, Alejandro Pulver
<alejandro@varnet.biz> wrote:`man bc`> Hello,
>
> Is there a way to handle numeric variables (addition, multiplication, etc.) in 'sh' (or throught an external command)?
>
--
If I write a signature, my emails will appear more personalised.
Eric Kjeldergaard Guest
-
Alejandro Pulver #4
Re: How to handle numeric variables in sh?
On Sat, 19 Feb 2005 10:07:51 -0600
Eric Kjeldergaard <kjelderg@gmail.com> wrote:
Thank You.> On Sat, 19 Feb 2005 12:55:59 -0300, Alejandro Pulver
> <alejandro@varnet.biz> wrote:>> > Hello,
> >
> > Is there a way to handle numeric variables (addition, multiplication, etc.) in 'sh' (or throught an external command)?
> >
> `man bc`
>
> --
> If I write a signature, my emails will appear more personalised.
> _______________________________________________
> [email]freebsd-questions@freebsd.org[/email] mailing list
> [url]http://lists.freebsd.org/mailman/listinfo/freebsd-questions[/url]
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
Best Regards,
Ale
Alejandro Pulver Guest
-
Jon Drews #5
Re: How to handle numeric variables in sh?
Ale:
On Sat, 19 Feb 2005 12:55:59 -0300, Alejandro Pulver
<alejandro@varnet.biz> wrote:Here is a good short "HowTo" on calling bc:> Hello,
>
> Is there a way to handle numeric variables (addition, multiplication, etc.) in 'sh' (or throught an external command)?
---------------------------------------------------------------------------------------------------------------------------------->> Shell Tip: Calculating with large numbers using "bc"
[url]http://www.shelldorado.com/newsletter/issues/2002-3-Aug.html[/url]
Shelldorado is a great reference site:
[url]http://www.shelldorado.com/[/url]
Jon Drews Guest
-
Alejandro Pulver #6
Re: How to handle numeric variables in sh?
On Sat, 19 Feb 2005 10:24:04 -0500
Scott Milliken <scott.milliken@e-comsultant.net> wrote:
Thank You.> Here's a code snippet of a script I use often to number a bunch of pics
> in a directory that I think shows how to do what you want to do:
>
> $PICNUM=100
> for FNAME in DSC*.JPG
> do
> NEWNAME=My_Pictures-$PICNUM.jpg
> mv $FNAME $NEWNAME
> PICNUM=$(($PICNUM+1))
> done
>
> This works in /bin/sh from my FreeBSD 4.11 system and also bash. If you
> want to perform a mathematical operation on a shell variable, just
> surround the expression with $(( expr )) and it'll work.
>
> Hope that helps.
>
> Scott Milliken
>
Y saw the use of '$(( expr ))' some time ago in 'Advanced Bash Scripting Guide', but I thought it was only for 'bash'.
I am using FreeBSD 5.3 and it also works in '/bin/sh'.
Best Regards,
Ale
Alejandro Pulver Guest
-
Alejandro Pulver #7
Re: How to handle numeric variables in sh?
On Sat, 19 Feb 2005 09:33:11 -0700
Jon Drews <jon.drews@gmail.com> wrote:
Interesting site.> Ale:
>
>
> On Sat, 19 Feb 2005 12:55:59 -0300, Alejandro Pulver
> <alejandro@varnet.biz> wrote:>> > Hello,
> >
> > Is there a way to handle numeric variables (addition, multiplication, etc.) in 'sh' (or throught an external command)?
> Here is a good short "HowTo" on calling bc:
> -----------------------------------------------------------------> -----------------------------------------------------------------> >> Shell Tip: Calculating with large numbers using "bc"
> [url]http://www.shelldorado.com/newsletter/issues/2002-3-Aug.html[/url]
>
> Shelldorado is a great reference site:
>
> [url]http://www.shelldorado.com/[/url]
> _______________________________________________
> [email]freebsd-questions@freebsd.org[/email] mailing list
> [url]http://lists.freebsd.org/mailman/listinfo/freebsd-questions[/url]
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
Thank You.
Best Regards,
Ale
Alejandro Pulver Guest
-
JarJarBings #8
Re: How to handle numeric variables in sh?
hi,
have a look at "man expr"
regards
Alejandro Pulver wrote:> Hello,
>
> Is there a way to handle numeric variables (addition, multiplication, etc.) in 'sh' (or throught an external command)?
>
> Thanks and Best Regards,
> Ale
> _______________________________________________
> [email]freebsd-questions@freebsd.org[/email] mailing list
> [url]http://lists.freebsd.org/mailman/listinfo/freebsd-questions[/url]
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
>JarJarBings Guest
-
Alejandro Pulver #9
Re: How to handle numeric variables in sh?
On Sat, 19 Feb 2005 20:16:23 +0100
JarJarBings <jarjarbings@aon.at> wrote:
Thank You.> hi,
>
> have a look at "man expr"
>
> regards
>
> Alejandro Pulver wrote:> > Hello,
> >
> > Is there a way to handle numeric variables (addition, multiplication, etc.) in 'sh' (or throught an external command)?
> >
> > Thanks and Best Regards,
> > Ale
Bests Regards,
Ale
Alejandro Pulver Guest



Reply With Quote

