On Mon, 2013-09-23 at 14:19 -0300, Beco wrote:
> On 23 September 2013 09:43, Ralf Mardorf <ralf.mard...@alice-dsl.net> wrote:
> > Hi,
> >
> > is there a way to set and clear bits of a byte in a bash script, by
> > using "or" and "and" or has this to be done by an annoying workaround?
> >
> > I don't find an answer, when I search the Internet.
> >
> > Regards,
> > Ralf
> >
> Hi Ralf,
> 
> Try this [1] method:
> 
> $let RE="5&1"
> $echo $RE
> 1
> $let RE="5>>1"
> $echo $RE
> 2
> 
> My best!
> Beco.
> 
> 
> 
> [1] from google keywords "bash script bitwise operations", second result.
> 
> http://my.safaribooksonline.com/book/operating-systems-and-server-administration/linux/0672326426/expressions/ch06lev1sec9

Thank you Beco :)

$ let "RESULT=5 | 3"
$ echo $RESULT
7
$ let "RESULT=5 & 3"
$ echo $RESULT
1

Excellent, exactly what I need.

Regards,
Ralf


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1379957685.1022.250.camel@archlinux

Reply via email to