Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'yet another startup script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
yet another startup script
Authored by: smeger on Jan 22, '03 10:29:49PM
I'm using bash under 10.2.2. In ~/.bash_profile, I've got:
exec screen
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
    source ~/.bashrc
In ~/.bashrc, I've got:
# If running interactively, then:
if [ "$PS1" ]; then

    # set a fancy prompt
    PS1='El Smeg:\w\$ '

    # stuff for 'screen'
		# Login greeting ------------------
		if [ ! $SHOWED_SCREEN_MESSAGE ]; then
			detached_screens=`screen -list | sed -n 's/^\(.*\)(Detached)$/|\1|/gp'`
			if [ ! -z "$detached_screens" ]; then
				echo "+---------------------------------------+"
				echo "| Detached screens are available:       |"
				echo -n "$detached_screens"
				echo "+---------------------------------------+"
				echo "+-----------------------------------------+"
				echo "[ There are no detached screens available ]"
				echo "+-----------------------------------------+"
			export SHOWED_SCREEN_MESSAGE="true"
In NetInfo Manager, I've got my shell set to /bin/bash (and using 'chsh'). The result of all of this is that when I open a new terminal window, it automatically starts 'screen' and shows me whether I've got any existing open sessions. One last thing, supposedly you can use 'screen' to set the window title by the last command entered, but I can't get it to work properly. You can see more info searching 'man screen' for 'shelltitle'. I've got the following line in my ~/.bashrc:
    # set a fancy prompt
    PS1='El Smeg:\w\033k\033\134\$ '

[ Reply to This | # ]