I was trying to trap CtrlC or CtrlZ and clear the screen and repeat the loop without exiting – it's working but I need to press Enter to repeat the loop.
#!/bin/bash trap 'clear' 2 20 while : do clear echo -e "\n\t1. Create a user" echo -e "\t2. Create a Group" echo -e "\t3. Delete user" echo -e "\t4. Reset Password" echo -e "\n\tSelect one of the option : \c" read OPT done
When pressing CtrlC or CtrlZ it clears the screen but does not display the menu again.
I want to use this as a logon script where a user logs in and only gets this menu to work. If the user enters CtrlC or CtrlZ the script has to redisplay the menu, without coming to shell.