I am currently working on an embedded Linux system. For it to be similar to our other products I need to have it start a shell in a specified directory on boot, accessible using the serial port.
For that I have this line in the inittab-script:
This is working so far, only that the shell starts up with a pwd of /, instead of /mnt/flash.
The only way I can come up with is to have it not start /bin/sh but instead a script like that:
#!/bin/sh cd /mnt/flash /bin/sh
Is there a way to do that in-line in the inittab without a second script?
Edit: I need this to be a login script. This is what the
- before the
/bin/sh signifies. If I just run
::respawn:/bin/sh -c "cd /mnt/flash;exec /bin/sh" it does change the folder as expected, but I don't get a login shell which causes other problems.
If I run it with
::respawn:-/bin/sh -c "cd /mnt/flash;exec /bin/sh I get this error:
/bin/sh: exec: line 1: -/bin/sh: not found