- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - HP-UX
- >
- System Administration
- >
- PS1 Confusion
-
-
Categories
- Topics
- Hybrid IT with Cloud
- Mobile & IoT
- IT for Data & Analytics
- Transformation
- Strategy and Technology
- Products
- Cloud
- Integrated Systems
- Networking
- Servers and Operating Systems
- Services
- Storage
- Company
- Events
- Partner Solutions and Certifications
- Welcome
- Welcome
- Announcements
- Tips and Tricks
- Feedback
-
Blogs
- Alliances
- Around the Storage Block
- Behind the scenes @ Labs
- Converged Data Center Infrastructure
- Digital Transformation
- Grounded in the Cloud
- HPE Careers
- HPE Storage Tech Insiders
- Infrastructure Insights
- Inspiring Progress
- Internet of Things (IoT)
- My Learning Certification
- Networking
- OEM Solutions
- Servers: The Right Compute
- Telecom IQ
- Transforming IT
-
Quick Links
- Community
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Contact
- Email us
- Tell us what you think
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Enterprise.nxt
- Marketplace
- Aruba Airheads Community
-
Categories
-
Forums
-
Blogs
-
InformationEnglish
PS1 Confusion
SOLVED- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-13-2009 01:50 PM
03-13-2009 01:50 PM
export PS1="$accountName "'${PWD##*($HOME|$HOME/)}$ '
The prompt looks like this:
[aea11-un] data$
The account name is "aea11-un"
The PWD is set to /ifastest/bsi/data
The $HOME is set to /ifastest/bsi
I'm confused about the two ## and the *. What do they do?
And the $HOME|$HOME/ ? Confused on what it does.
Looks like it is stripping off the 1st two nodes of the pwd command.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-13-2009 02:02 PM
03-13-2009 02:02 PM
Solution> I'm confused about the two ## and the *. What do they do?
Just what you deduced. The '${parameter##pattern}' is described in the 'sh-posix' manpages. If the pattern matches the beginning of the value of parameter, the value of this substitution is the value of the parameter with the matched portion deleted.
See the Pattern Substitution section of:
http://www.docs.hp.com/en/B2355-60105/sh-posix.1.html
> And the $HOME|$HOME/ ? Confused on what it does.
This says to match either the value of '$HOME' or ('|') the value of '$HOME/' (that is with a forward slash following it.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-13-2009 02:11 PM
03-13-2009 02:11 PM
Re: PS1 Confusion
Re: PS1 Confusion
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-13-2009 08:27 PM
03-13-2009 08:27 PM
Re: PS1 Confusion
Re: PS1 Confusion
Your the best!
And thanks for the link to the HP docs section on pattern substitution. That paper has cleared up a lot of other questions I had.
This forum is priceless!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-14-2009 07:38 PM
03-14-2009 07:38 PM
Re: PS1 Confusion
Re: PS1 Confusion
export PS1="$accountName "'${PWD##${PWD%/*/*}/} $'
In this example, the lowest two directories are shown. So if you change to /usr/local/bin, the prompt will be:
[aea11-un] local/bin $
Knowing that you are in the bin directory is not enough. The current PWD and the parent provide most of the details without showing the entire $PWD.
Further details: The double quotes around "$accountName " will be set permanently with PS1= assignment but the single quotes (apostrophes) will be evaluated every time the PS1 variable is displayed.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-14-2009 07:58 PM
03-14-2009 07:58 PM
Re: PS1 Confusion
Re: PS1 Confusion
Thank you for the update. Never knew the PS1 prompt had sooo many options. I'll try your recommendation.
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2018 Hewlett Packard Enterprise Development LP