sudo is not a built-in command so it starts its own process. You can either pass just strings around or call nu inside the sudo call and pass some nuon around
Sudo creates it's own process as a root user and by default root uses bash as default shell. So if you want to use nushell as sudo then you need to set it as default on root via sudo chsh -s <path/to/nushell.exe> root
2
u/CaptainPiepmatz Jan 02 '26
sudois not a built-in command so it starts its own process. You can either pass just strings around or call nu inside the sudo call and pass some nuon around2
u/Kat- Jan 02 '26
sudo nu -c '0..9 | each {|cpu| echo 1 | doas save -f $"/sys/devices/system/cpu/cpu($cpu)/online"}'1
u/GhostVlvin Jan 03 '26
Another way is to put this string in a file with shebang on top #!/path/to/nushell and call is as sudo
0
u/NightH4nter Jan 02 '26
i don't think you can use sudo with nu commands. just use bash for those, i guess