What happened, and what did you expect to happen?
Not 100% sure if this is a bug or intended behavior, but redirects with exec seem to do nothing (which is not the way it works in bash for example).
To demonstrate this, I'm going to spawn a shell in a shell and use # for the first shell prompt and $ for the subshell prompt.
Doing the following in Elvish
# exec elvish >test.log
$ echo test
will echo test to the console and leave test.log empty, while
# elvish >test.log
$ echo test
will write test to test.log as desired. Doing the same experiment in bash, the first example acts the same as the second example, i.e. test is not output to the console and instead test.log contains test.
This came up because I wanted to write a wrapper script for a program to set some environment variables and redirect output to a log file, and thought that execing the program at the end of the script was the natural thing to do.
Output of "elvish -version"
0.21.0+archlinux1
Code of Conduct
What happened, and what did you expect to happen?
Not 100% sure if this is a bug or intended behavior, but redirects with
execseem to do nothing (which is not the way it works inbashfor example).To demonstrate this, I'm going to spawn a shell in a shell and use
#for the first shell prompt and$for the subshell prompt.Doing the following in Elvish
will echo
testto the console and leavetest.logempty, whilewill write
testtotest.logas desired. Doing the same experiment inbash, the first example acts the same as the second example, i.e.testis not output to the console and insteadtest.logcontainstest.This came up because I wanted to write a wrapper script for a program to set some environment variables and redirect output to a log file, and thought that
execing the program at the end of the script was the natural thing to do.Output of "elvish -version"
0.21.0+archlinux1
Code of Conduct