compare ksh:
$ echo $KSH_VERSION
Version AJM 93u+m/1.0.8 2024-01-01
$ exec {fd}<.profile
$ echo $fd
11
$ ksh
$ lsof -ap$$ -d11
$
and bash:
$ echo $BASH_VERSION
5.2.26(1)-release
$ exec {fd}<.profile
$ echo $fd
10
$ bash
$ lsof -ap$$ -d10
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
bash 42373 adavies 10r REG 1,4 0 12988192685 /Users/adavies/.profile
$
zsh behaves like bash
this breaks patterns like
$ exec {fd}<.profile
$ flock $fd
flock: data error: Bad file descriptor
$
since flock(1) doesn't see that file descriptor as open
strace shows ksh launches processes with vfork(2), while bash uses clone(2); maybe this is the cause of the difference?
compare ksh:
and bash:
zsh behaves like bash
this breaks patterns like
since
flock(1)doesn't see that file descriptor as openstraceshows ksh launches processes withvfork(2), while bash usesclone(2); maybe this is the cause of the difference?