as title says I have a centOS 6 machine which uses an dracut, initramfs preboot ssh. I want to create a shell script that at the end of it's execution it closes the console and ssh connection. How can I do that. Escape character ~. does not work.
You have to determine PID of shell started after SSH-session has been established - and kill it. SSH session terminates automatically. Most shells has variable $$ that contains PID of parent shell. So just add to your script last line: