mirror of
https://github.com/nushell/nushell.git
synced 2024-12-02 13:24:30 +01:00
28 lines
336 B
Markdown
28 lines
336 B
Markdown
---
|
|
title: keep
|
|
layout: command
|
|
version: 0.59.1
|
|
---
|
|
|
|
Keep the first n elements of the input.
|
|
|
|
## Signature
|
|
|
|
```> keep (n)```
|
|
|
|
## Parameters
|
|
|
|
- `n`: the number of elements to keep
|
|
|
|
## Examples
|
|
|
|
Keep two elements
|
|
```shell
|
|
> echo [[editions]; [2015] [2018] [2021]] | keep 2
|
|
```
|
|
|
|
Keep the first value
|
|
```shell
|
|
> echo [2 4 6 8] | keep
|
|
```
|