Home Explore Blog CI



nushell

commands/docs/bits_or.md
3e3d69f26de4173783dc0fdd2bbe527b3b75b5e770c545380000000300000777
---
title: bits or
categories: |
  bits
version: 0.104.0
bits: |
  Performs bitwise or for ints or binary values.
usage: |
  Performs bitwise or for ints or binary values.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `bits or` for [bits](/commands/categories/bits.md)

<div class='command-title'>Performs bitwise or for ints or binary values.</div>

## 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       |
| ------------ | ------------ |
| binary       | binary       |
| int          | int          |
| list\<binary\> | list\<binary\> |
| list\<int\>    | list\<int\>    |
## Examples

Apply bits or to two numbers
```nu
> 2 | bits or 6
6
```

Apply bitwise or to a list of numbers
```nu
> [8 3 2] | bits or 2
╭───┬────╮
│ 0 │ 10 │
│ 1 │  3 │
│ 2 │  2 │
╰───┴────╯

```

Apply bitwise or to binary data
```nu
> 0x[88 cc] | bits or 0x[42 32]
Length: 2 (0x2) bytes | printable whitespace ascii_other non_ascii
00000000:   ca fe                                                ××

```

Apply bitwise or to binary data of varying lengths with specified endianness
```nu
> 0x[c0 ff ee] | bits or 0x[ff] --endian big
Length: 3 (0x3) bytes | printable whitespace ascii_other non_ascii
00000000:   c0 ff ff                                             ×××

```

Apply bitwise or to input binary data smaller than the operor
```nu
> 0x[ff] | bits or 0x[12 34 56] --endian little
Length: 3 (0x3) bytes | printable whitespace ascii_other non_ascii
00000000:   ff 34 56                                             ×4V

```

Chunks
cf2adc48 (1st chunk of `commands/docs/bits_or.md`)
Title: bits or
Summary
The `bits or` command performs a bitwise OR operation on integers or binary values. It accepts a target value as input and can operate on single values or lists. The `--endian` flag allows specifying the byte encoding endianness for binary data.