6
submitted 2 months ago* (last edited 2 months ago) by trymeout@lemmy.world to c/nushell@programming.dev

To be able to run Nushell scripts from your File Manager and have the terminal window of the running script not close when the script is finished executing or if the scripts exits, you can use these instructions to achieve this.

This example is on Linux Mint using Nemo as a file manager and GNOME Terminal as a terminal app.

  • Create the following script on your system and store the file where ever you like...

run-in-terminal.nu

def run-in-terminal [code: string] {
    # Using GNOME Terminal
    gnome-terminal -- nu -c ($code)
}

# The Nushell code that runs in the terminal
def get-terminal-code [script: string] {
    return $"
        try {
            nu ($script)

            print ''
            print ''
            print ''
            print 'Script finished executing'
        } catch {
            print ''
            print ''
            print ''
            print 'Script failed executing'
        }

        print ''

        # Must press enter to close terminal window
        input 'Press Enter to exit'
    "
}

def main [script:string] {
    run-in-terminal (get-terminal-code $script)
}
  • Create the Nemo action file and in the file, replace /path/to/run-in-terminal.nu with the path to the run-in-terminal.nu file...

~/.local/share/nemo/actions/nushell.nemo_action

[Nemo Action]
Name=Run in Terminal
Comment=Execute script in Terminal
Exec=nu /path/to/run-in-terminal.nu %F
Icon-Name=terminal
Selection=Single
Extensions=nu;

Now simply right click on any Nushell script file (.nu) in Nemo and you will see an option Run In Terminal.

no comments (yet)
sorted by: hot top new old
there doesn't seem to be anything here
this post was submitted on 10 Jun 2026
6 points (100.0% liked)

Nushell

124 readers
1 users here now

What is Nushell?

Nushell is a powerful shell and scripting language with strong typing, querying, and piping functionalities.

From the official documentation; Introduction:

The goal of this project is to take the Unix philosophy of shells, where pipes connect simple commands together, and bring it to the modern style of development. Thus, rather than being either a shell, or a programming language, Nushell connects both by bringing a rich programming language and a full-featured shell together into one package.

Nu takes cues from a lot of familiar territory: traditional shells like bash, object based shells like PowerShell, gradually typed languages like TypeScript, functional programming, systems programming, and more. But rather than trying to be a jack of all trades, Nu focuses its energy on doing a few things well:

Examples

Shell Examples…

0x[7F000001] | chunks 1 | each { into int } | str join "."
# => 127.0.0.1
ls | where size > 1kb
# => ╭───┬───────────────────┬──────┬─────────┬────────────╮
# => │ # │       name        │ type │  size   │  modified  │
# => ├───┼───────────────────┼──────┼─────────┼────────────┤
# => │ 0 │ Gemfile           │ file │ 1.1 KiB │ 3 days ago │
# => │ 1 │ Gemfile.lock      │ file │ 6.9 KiB │ 3 days ago │
# => │ 2 │ LICENSE           │ file │ 1.1 KiB │ 3 days ago │
# => │ 3 │ SUMMARY.md        │ file │ 3.7 KiB │ 3 days ago │
# => ╰───┴───────────────────┴──────┴─────────┴────────────╯
help commands | where name == each | first | get params.name
# => ╭───┬──────────────────╮
# => │ 0 │ closure          │
# => │ 1 │ --help(-h)       │
# => │ 2 │ --keep-empty(-k) │
# => ╰───┴──────────────────╯
http get https://programming.dev/api/v3/site | get all_languages | length
# => 184

http get https://programming.dev/api/v3/site | get taglines.content
# => ╭───┬────────────────────────────────────╮
# => │ 0 │ Broken communities have been fixed │
# => ╰───┴────────────────────────────────────╯

Web-Links

founded 2 years ago
MODERATORS