LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 05-01-2008, 09:54 PM   #1
tschima
Member
 
Registered: Apr 2006
Location: Arizona
Distribution: LinuxMint, NomadBSD, OtherBSD
Posts: 109

Rep: Reputation: 15
Root Shell, Path & Prompt


Hey Everyone,

Solaris SXDE 01/08 on amd64
Is it safe to use bash as the root shell? And if not, is is possible to change the prompt of the sh shell to something more usable? For instance, I'd like to have a 2-line prompt that looks like this:
root@servername
/somedir/anotherdir# _

And I'd like the word root to be in red so I am reminded to be careful and hurry up and log out.

This is the bash equivalent to PS1="\u\h\n\w# " without all the ascii color codes.

How do I know what directories to add to my path? I downloaded gcc from sunfreeware.com and got it installed (I think) w/pkgadd -d, but it's not in the path or maybe the libraries aren't? I wanted to install Midnight Commander, also from the same source, but it doesn't want to work for some reason. I did download and install all the listed dependencies, but there must be something else to this. Should I have installed by clicking an icon instead of the command line pkgadd -d? Thanks,

Terry

Last edited by tschima; 05-01-2008 at 09:59 PM. Reason: Forgot to mention the specific OS
 
Old 05-02-2008, 04:13 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Of course you can use bash, if you're familiar with it
Quote:
How do I know what directories to add to my path? I downloaded gcc from sunfreeware.com and got it installed (I think) w/pkgadd -d, but it's not in the path or maybe the libraries aren't?
I don't know about Solaris SXDE, but Solaris 10 comes with gcc installed in /usr/sfw/bin (not in the default PATH anyway). The freeware gcc and other utils are installed under /usr/local/bin, so you have to add this directory in your PATH, in order to be able to use them.

Regards
 
Old 05-02-2008, 08:56 AM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
For question 1, it isn't recommended to change root's shell if you are mounting /usr on a different file system. Otherwise, there is no problem outside the fact login in as root is a poor practice, but you already know that.
About question 2, here is a shell script that will show you a populated PATH and MANPATH for Solaris. It looks into all standard and less standard places. The PATH can probably be cleaned up to remove unwanted directories or reorder some others as the same command may appear at different location.
Code:
#!/bin/ksh
for p in PATH MANPATH
do
  case $p in
  (PATH)
    _PATH=""
    for i in /usr/ucb $HOME/bin /opt/*/bin /usr/*/*/bin /sbin /usr/sbin /usr/*/bin /sbin /usr/bin ; do
      if [ -d $i ]; then
        for cmd in $i/*; do
          if [ -x $cmd ]; then
            eval _PATH=$i:$_PATH
            break
          fi
        done
      fi
    done
    ;;
  (MANPATH)
    _MANPATH=""
    for i in /opt/*/man /opt/*/share/man /usr/local/man /usr/local/*/man /usr/*/share/man /usr/*/man ;  do
      if [ -d $i ]; then
        eval _MANPATH=$i:$_MANPATH
      fi
    done
    ;;
  esac
  eval printf "%s=%s\\\n" $p \$_$p
done
 
Old 05-03-2008, 09:51 PM   #4
tschima
Member
 
Registered: Apr 2006
Location: Arizona
Distribution: LinuxMint, NomadBSD, OtherBSD
Posts: 109

Original Poster
Rep: Reputation: 15
Thanks guys.

Terry
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Shell tip: Set the shell prompt and themes in Linux Terminal LXer Syndicated Linux News 0 06-12-2007 03:02 AM
shell script + change shell && continue darkRoom Programming 6 02-25-2005 02:50 AM
Placing current path in the prompt zepplin611 Linux - General 2 05-13-2004 12:07 PM
Shell Prompt xneowolf Linux - General 5 01-26-2003 02:06 AM
C shell prompt robson Linux - General 2 11-12-2001 08:08 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 02:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration