Assuming your config file is /etc/dynshell.cfg
and contains the device name (like ttyS0
) on one line, and nothing else, you can write this…
#!/bin/sh
port=/dev/$(</etc/dynshell.cfg)
exec /bin/bash <$port >$port 2>$port
… into /usr/local/sbin/dynshell
, then use this line:
::respawn:/usr/local/sbin/dynshell
Although this might be better/safer:
#!/bin/sh
port=/dev/$(</etc/dynshell.cfg)
exec /bin/bash 0<>$port >&0 2>&0