[ubuntu-studio-users] [solved] Set and clear bits in a bash script

Ralf Mardorf ralf.mardorf at alice-dsl.net
Mon Sep 23 17:39:16 UTC 2013


-------- Forwarded Message --------
From: Ralf Mardorf
To: debian-user <debian-user at lists.debian.org>
Subject: [solved] Set and clear bits in a bash script
Date: Mon, 23 Sep 2013 19:34:45 +0200

On Mon, 2013-09-23 at 14:19 -0300, Beco wrote:
> 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

Archive: http://lists.debian.org/1379957685.1022.250.camel@archlinux






More information about the ubuntu-studio-users mailing list