Nushell "fill"

I'm currently learning Nushell and I wanted to know, how I can fill a number with leading zeros. ChatGPT answered this:

image.png

This translates to:

Okay, I found out, that the command fill exists. But the code just did nothing. Why? because the flags are wrong.

In this scenario I learned about fill, but I had to check the flags. Usually tools bring manuals with, like the unix manual pages, a help command, documentation website, and so on. I would recommend at this point not to ask AI, but instead improving your search skills by searching the help for the command. In my case, using nushell, I just typed help fill.

The help page for fill shows this:

image.png

So -a is not the fill character, it is the alignment, which should be r. But there is also -c, which is the character, which should be 0. Thus creating the correct answer:

let x = 42
print ($x | fill -a r -c 0 -w 4)

 


Revision #1
Created 2026-08-30 11:19:59 UTC by Matthias
Updated 2026-08-30 11:27:40 UTC by Matthias