bits or

For bits.

Performs bitwise or for ints or binary values.

Command Type

built-in

Signature

> bits or {flags} (target)

Flags

  • --endian, -e {string}: Byte encode endian, available options: native(default), little, big.

Parameters

  • target: Right-hand side of the operation.

Input/output types:

input output
int int
binary binary
list<int> list<int>
list<binary> list<binary>

Examples

Apply bits or to two numbers

> 2 | bits or 6
6

Apply bitwise or to a list of numbers

> [8 3 2] | bits or 2
╭───┬────╮
│ 0 │ 10 │
│ 1 │  3 │
│ 2 │  2 │
╰───┴────╯

Apply bitwise or to binary data

> 0x[88 cc] | bits or 0x[42 32]
Length: 2 (0x2) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   ca fe                                                ××

Apply bitwise or to binary data of varying lengths with specified endianness

> 0x[c0 ff ee] | bits or 0x[ff] --endian big
Length: 3 (0x3) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   c0 ff ff                                             ×××

Apply bitwise or to input binary data smaller than the operor

> 0x[ff] | bits or 0x[12 34 56] --endian little
Length: 3 (0x3) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   ff 34 56                                             ×4V

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.