News for hackers. Stuff that matters.
Re:Nushell 0.60 Released by ripley12 on Wednesday March 23, 2022 @12:41AM (#30775031)
> I don't think there is a way to do something like `exec {myvar}>file`

I might be misunderstanding this, but piping to `save` is how you usually redirect to a file in Nu: https://www.nushell.sh/book/commands/save.html

Re:Nushell 0.60 Released by thayne on Wednesday March 23, 2022 @03:31AM (#30775961)
`exec {myvar}>file` will open a file descriptor that can write to `file`, and then store that file descriptor in the variable `$myvar`, so you can then redirect additional commands to it with `>$myvar` or `>>$myvar`.

From the bash man page:

> Each redirection that may be preceded by a file descriptor number may instead be preceded by a word of the form {varname}. In this case, for each redirection operator except >&- and <&-, the shell will allocate a file descriptor greater than or equal to 10 and assign it to varname. If &- or <&- is preceded by {varname}, the value of varname defines the file descriptor to close. If {varname} is supplied, the redirection persists beyond the scope of the command, allowing the shell programmer to manage the file descriptor himself.

Re:Nushell 0.60 Released by ripley12 on Wednesday March 23, 2022 @05:02PM (#30783335)
Thanks, I was misunderstanding.