LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-16-2009, 04:58 AM   #1
linuxjamil
Member
 
Registered: Dec 2005
Distribution: Fedora Core 5, Sun Solaris 8
Posts: 122

Rep: Reputation: 15
Thumbs down How to set PS2 , PS3 and PS4 variable.


Dear All

This is very long since that I cannot solve the problem of PS1, PS2 , PS3 variable. My problem is I cannot set PS2 , PS3 , PS4 variable in linux and as well now in Solaris 10..

Would you please tell how to set these variables and what is the definition of these variables in Linux ?

Please respond.
 
Old 07-16-2009, 05:59 AM   #2
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 988
Blog Entries: 4

Rep: Reputation: 254Reputation: 254Reputation: 254
It's Nothing but a Shell Thing

Greetingz!

For starters, the PS1, PS2, PS3 and PS4 variables are a "shell" thing, not necessarily a Linux thing.

Depending on the shell you're using, you may have all four (like with bash), on only two (like the regular bourne shell "sh").

To set one of them in most shells, just type the following;
$ export PS2=" > "
From the bash 3.2.25 man page;
PS1 The value of this parameter is expanded (see PROMPTING below) and used as the primary prompt string. The default value is "\s-\v\$".

PS2 The value of this parameter is expanded as with PS1 and used as the secondary prompt string. The default is "> ".

PS3 The value of this parameter is used as the prompt for the select command (see SHELL GRAMMAR above).

PS4 The value of this parameter is expanded as with PS1 and the value is printed before each command bash displays during an execution trace. The first character of PS4 is replicated multiple times, as necessary, to indicate multiple levels of indirection. The default is "+ ".
If you find this helpful, click the "thumbs-up" on this post.
Also, if this post answers your question, feel free to mark this thread as "Solved".

Have a good one!

Last edited by xeleema; 07-16-2009 at 06:01 AM.
 
Old 07-16-2009, 06:52 AM   #3
barunparichha
Member
 
Registered: Jun 2006
Location: Bangalore,india
Distribution: Linux(Redhat,fedora,suse,ubantu), Solaris (s8/s9/s10/nevada/open-solaris)
Posts: 303

Rep: Reputation: 32
U can also put exert PS1=">" in some startup script like .bashrc, to make this permanent.
 
Old 07-16-2009, 07:44 AM   #4
barunparichha
Member
 
Registered: Jun 2006
Location: Bangalore,india
Distribution: Linux(Redhat,fedora,suse,ubantu), Solaris (s8/s9/s10/nevada/open-solaris)
Posts: 303

Rep: Reputation: 32
In Solaris 10:

$echo $PS1
${CUE_HOSTNAME}:"$PWD" \! $

$export PS1="${CUE_HOSTNAME}:"$PWD" \! >"

This changes my $ to >.
 
Old 07-16-2009, 09:26 AM   #5
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Quote:
Originally Posted by barunparichha View Post
U can also put exert PS1=">" in some startup script like .bashrc, to make this permanent.

"export" not "exert". Please take the time to use proper English, for the sake of accuracy and of those who don't speak English as a first language.
 
  


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
how to set a variable in a script and have the variable still set after script termin john test Linux - Newbie 9 10-21-2008 05:21 PM
What are PS1, PS2, PS4 variables for? muazfarooqaslam Linux - Newbie 8 01-03-2008 07:57 PM
Can the PS2 hardware be accessed on PS3 with Linux? shorty_boy Linux - Hardware 8 11-05-2007 11:10 PM
*** how to set up a variable in Linux? *** meili100 Linux - Newbie 2 10-05-2007 08:31 PM
Set variable with value of another Ephracis Programming 7 12-25-2004 10:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:40 AM.

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