On Sat, Aug 19, 2023, 16:42 jleivent <jleiv...@comcast.net> wrote: > bash: exec: 10: not found > But even that shouldn't cause the shell to terminate if the > target isn't found, so maybe this is two bugs? > > Repeat-By: > > exec {foo}>/tmp/foo > exec "${foo}"<&- >
Looks like bash doesn't undo redirections if the exec fails -- so the shell terminates because the redirection closed stdin. I agree it would probably make sense to undo them if the exec fails and the shell is not going to exit. >