The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to change the system prompt and BG of terminal? wrapster SUN Solaris 4 04-25-2008 03:23 AM
How can I change the behavior of the mouse in Terminal? TheChemist UNIX for Dummies Questions & Answers 0 03-03-2008 04:06 PM
Change title of aixterm window online Soham UNIX for Advanced & Expert Users 1 02-01-2008 01:52 PM
Change putty title window? akbar UNIX for Advanced & Expert Users 12 01-28-2008 01:38 PM
Change Console Title medmonson UNIX for Dummies Questions & Answers 8 06-09-2004 08:48 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #8 (permalink)  
Old 11-20-2005
mschwage mschwage is offline
Registered User
  
 

Join Date: Jul 2005
Location: Oak Park, IL
Posts: 102
Dude, it's UNIX... you can do whatever you want. Here's some functions that should work in ksh or bash. Notice that if you put this in your .bashrc or .kshrc file using vi, you would create the "^[" by pressing control-V and then the Escape key. ^G is created by control-V and then control-G. All other characters are verbatim, and are the property of their owners.

wt changes the window title on the fly. Use it like: wt anything you want
it changes the window title and the icon title. Usage: it anything you want
defwt is my default window title, it shows you how to put a shell function in the window title.
cls is clear screen. Xterms are like vt100's, so it will work.

These functions work for many other vt100 emulators, I have found.

This is for Sun's echo command, which takes a \c to tell you not to send a carriage return at the end. For Linux you have to use its version. I think echo is deprecated and you want to use printf, but I'm not in front of Linux right now to check if it has printf also.

Code:
# X title stuff
        wt ()
        {
                echo "^[]2;${@}^G\c"
        }
        it ()
        {
                echo "^[]0;${@}^G\c"
        }
        defwt ()
        {
                echo "^[]2;$(whoami) @ $(hostname)^G"
        }
        cls ()
        {
          # works only for vt100's and the like
               echo "^[[;H^[[2J"
        }
In Real Life, I have yet another function that dynamically modifies my window title to show me my current directory, but that will cost you extra.

Oh, ok... this works on bash but my older version worked on ksh. You would have to figure out how to get it to work with ksh. Better to switch to bash, IMHO.

Code:
PROMPT_COMMAND=pc
titlebar="$myhostname ::: $myname   "
tprompt="[$myname@$myhostname]"
        if [ "$TERM" != "void" -a "$TERM" != "dumb" ] ; then
                bold=`tput bold`
                normal=`tput rmso`
                PROMPT_COMMAND=pc
                #PS1="\!\\[$bold\\]\`promptlen\`\\[$normal\\]\\$ "
        fi
function pc
        {
                pc_wd=`pwd`
                if [ \( "$TERM" = "vt100" \) -o \( "$TERM" = "xterm" \) ] ; then
                        wt "$titlebar << `pwd` >>" > `tty`
                fi
                # go to a 2-line prompt if >38 chars in path...
                case "$pc_wd" in
                /)
                        pc_path="/" ; pc_suffix="\\$ "
                ;;
                $HOME)
                        pc_path="~" ; pc_suffix="\\$ "
                ;;
                ??????????????????????????????????????*)
                        pc_path=$pc_wd ; pc_suffix="\n\\$ "
                ;;
                *)
                        pc_path=$pc_wd ; pc_suffix="\\$ "
                ;;
                esac
                PS1="\!\\[$bold\\]${tprompt}${pc_path}\\[$normal\\]${pc_suffix}"
                return
        }
...bold and normal do not work under Linux here. This is from my Sun, sorry. I have a version that works on Linux and Solaris but it's at work and I'm not.
-Mike

Last edited by mschwage; 11-20-2005 at 02:54 AM.. Reason: Drat, forgot arguments
  #9 (permalink)  
Old 11-21-2005
here2learn here2learn is offline
Registered User
  
 

Join Date: Nov 2003
Posts: 53
Thanks for those additional options mschwage. Might have to incorporate some of those ideas.

For now, I'm using the ksh shell and was actually able to configure a PS1 command to get colors in my prompt and dynamically set the title bar based on working directory location.

Thanks again for all the help.
Sponsored Links
Closed Thread

Bookmarks

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 05:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0