I just run through a howto where I was asked to execute a command which used the command output from a subshell as an argument for another command. Copy&paste of such typical command examples don’t work with nushell:
❯ sudo usermod --append --groups libvirt $(whoami)
error: Variable not in scope
┌─ shell:9:40
│
9 │ sudo usermod --append --groups libvirt $(whoami)
│ ^^^^^^^^^ unknown variable: $(whoami)
The right way to do that in nushell is only slightly different – using subexpressions:
❯ sudo usermod --append --groups libvirt (whoami)
One thought on “[Short Tip] Executing a subshell in Nushell”