I have a menu system that all users are automatically directed to. This is done by changing the shell attribute in /etc/passwd to point to a script that sources the profile and generally sets up the environment before calling the main program.
For example, a store manager would be like this:
strmgr:x:1234:1234:Store Manager:/home/storeuser:/opt/menu/start_menu.sh
I'm looking for a way to capture STDERR from the login process to a file that I can then interrogate in the menu script itself, displaying the important pieces as needed.
My initial thought was to add exec &2>/tmp/$$.stderr
at the top of the script but that doesn't work as I'd hoped. There are still system generated messages that are masked by the menu display. I guess they're generated before this script is called, even though I'm not using the "normal" shell and .profile start-up.
Does anyone have an idea of how to do this? I've scoured google and found nothing.