Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions book/aliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,12 @@ def ls [
) | sort-by type name -i
}
```

To call the underlying built-in command you can use a percent sigil `%`, e.g.
```nu
def ls [] {
"something else"
}

%ls # <- calls the original ls
```
7 changes: 7 additions & 0 deletions lang-guide/chapters/strings_and_text.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ let arguments = ["arg1", "-a", "arg2"]

The caret `^` before the string interpolation symbol `$` allows that external command to be executed.

This comment was marked as low quality.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm, I didn't expand the diff, and just assumed the wrong thing


The percent sigin `%` can be used to call the built-in command (without arguments).

```nu
let cmd = "ls"
%$cmd
Copy link
Copy Markdown
Contributor

@fdncred fdncred May 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine but I'd do something like this just to drive the point home.

# call internal `ls` command
%$cmd
# call external `ls` command
^$cmd

Comment thread
samoylovfp marked this conversation as resolved.
```

## String Quoting

### Double quotes
Expand Down