Re: Misleading text: $(()) is not bash specific

Chris Down <[email protected]>
Newsgroups gmane.linux.utilities.smartmontools
Message-ID <[email protected]>
On 2014-01-15 19:09:21 +0100, Christian Franke wrote:
> No, the exponentiation operator (2**i) is also not part of POSIX.

Good catch, I missed that.

> It would probably make sense to use a more portable example, e.g.:
> 
> val=$?; mask=1
> for i in 0 1 2 3 4 5 6 7; do
>   echo "Bit $i: $(((val & mask) && 1))"
>   mask=$((mask << 1))
> done

That looks good to me. You could also use `let i++' and
`[ "$i" -lt 8 ]', but I don't think it offers much advantage.

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk

_______________________________________________
Smartmontools-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/smartmontools-support
signature.asc (application/pgp-signature, 836 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBAgAGBQJS11HRAAoJEMbcxX5GyInGuYMP/id6Rnp5fMd8cwn+S53XBznW
Ip4QMaf5ZwGue26dqahUl0ICXQu4cNKk0H3IpT8T5QnhEULq/cdNOxU8007onQbh
BHiaTRkeL5NOieXqqDiPqwVtQxUqyAsZwL2nzyDjvmNWdXdt7CsFWaJezJwJdjcD
LHY/otq/3/xh/0ysuEcCac4Ktzb8tdknhK0XuGFIwUS1VwXaQMQ/+0fRZ12nLZpp
O9eLgTz2oPECgoZRfW0Befz/mncfLcw+1sMcmv2GnXn9wNIW0PgeRaU5GveUbd/N
S10mPOu4dz9i3y7aZRcpi8krGSj2cDB6lqAd1Kwu8il7c2TTilkElEfSvaGRQa5R
xQvCn7x+hToK3J5BLCpwEXhuqDlnRJl2dahefLgjU7y9h090Mkr0maJGDydPHDNo
pAXHgj7Cmbv4IgCwK+O/hSNyVn8X6yndhVlRgCd7mlAuFua6moMBw3GRe/IMQF2c
P7jZOpezACEzFu/JWytnHrZUhbQ3PmoqOHJYT1OgzDTwacJx8wk+1ws4wiTAM/VX
CF3T8N8kKTqM6efDiyDqFntem1yRUE+y9i3egh/1VcQ4L5Njs/GatFewWNvfoPKc
BKfMDELyUcw4xwQMheAANCcNxfQhYgW/MxnEiAfIiSqdocYMMs+W0gHmb/912xTc
cCnVaXHlNKmuSu4ziGre
=bx/n
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.