#275678 optionally ask for confirmation before exiting the --login shell

#275678#3
Date:
2004-10-09 13:38:39 UTC
From:
To:
Using the login method for testing, it happened to me too many times
that I accidentally exited the shell and lost all work. So now,
I use the following script and the execut method instead, which
requires me to 'exit' and ctrl-c within one second to really exit
the pbuilder instance.

#!/bin/bash

while true; do
  echo "entering the shell..."
  /bin/bash </dev/tty >/dev/tty
  sleep 1
done

It would be nice if the login method could ask me if I really wanted
to exit, or respawn the shell if I don't. This can be made dependent
on a configuration variable.

Thanks,

#275678#6
Date:
2004-10-09 14:41:44 UTC
From:
To:
This is an improved implementation of a "phoenix" shell to be
executed with 'execute' instead of 'login':

#!/bin/sh

while true; do
  /bin/sh -il < /dev/tty &> /dev/tty
  echo
  echo '**[ WARNING ]****************'
  echo
  echo 'Are you sure you want to exit'
  echo 'and LOSE ALL CHANGES? If yes,'
  echo -n 'please answer with "yes": '
  read -e ans
  [[ $ans = 'yes' ]] && break
done