ls **/data.json | each {|it| mv $it.name $"(dirname $it.name)/data.yml" }
Will be much more complex in bash find -name "data.json" | xargs -i bash -c "mv \"{}\" \"\$(dirname '{}')/data.yml\""
Note the escaped quotes and dollar signs in bash. It is really difficult to get them right.In Nutshell we are actually using "functions" (supported syntax-wise) to do the job, so it will be much more simpler.
---
A more complex example from my recent code:
ls $"(which npm.ps1 | get 0.path | path dirname)/*.ps1" | each {|it| get name | path basename }
| each {|script_file| $"alias ($script_file | str replace ".ps1" "") = powershell.exe ($script_file)" }
| str join "\n" | save --force ~/.config/nushell/env-generated.nu
Will be something like this in bash, find "$(dirname "$(which npm.ps1)")/" -maxdepth 1 -name "*.ps1" | sed -r "s/^.*\/([^\/]+)\.ps1/alias \1 = powershell.exe \1.ps1/g" >> "$NU_CONFIG_FILE"
Although the bash one is shorter, it takes me 10x more time to write and test. I initially tried to write it with xrgs but given up due to the complexity involved.I think Nushell is more readable and easy to write for me.