- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: what' differenct of ' ' and " " in PS1 envirom...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- 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
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:15 PM
05-17-2004 05:15 PM
what' differenct of ' ' and " " in PS1 enviroment variable?
WILL WORK
BUT PS1="$(pwd)" not work
why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:23 PM
05-17-2004 05:23 PM
Re: what' differenct of ' ' and " " in PS1 enviroment variable?
single quotes keep the values as it is....
that echo $PS1 will be $PWD .i.e it doesnot expand the variable within the single quotes
but inside a double quotes it does.i.e the shell variable can be expanded from within the double quotes.
This is what happens in a POSIX shell for single and double quotes
with best wishes
Naveej
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:31 PM
05-17-2004 05:31 PM
Re: what' differenct of ' ' and " " in PS1 enviroment variable?
To make PS1="$(pwd)" work, we can change it to PS1="`pwd`"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:33 PM
05-17-2004 05:33 PM
Re: what' differenct of ' ' and " " in PS1 enviroment variable?
one more thing to add up
PWD is a shell variable
while pwd is a command.
regds
Naveej
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:33 PM
05-17-2004 05:33 PM
Re: what' differenct of ' ' and " " in PS1 enviroment variable?
and using command substitution, "$(pwd)", in the PS1 prompt variable will cause poor shell performance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:47 PM
05-17-2004 05:47 PM
Re: what' differenct of ' ' and " " in PS1 enviroment variable?
but why '$PWD' will prompt path ,
well "$(pwd)" only prompt old path for the
time the PS1 change ,but will not
change prompt when i change to other path?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 07:58 PM
05-17-2004 07:58 PM
Re: what' differenct of ' ' and " " in PS1 enviroment variable?
When shell sets PS1='$PWD', single quote are parsed.
So, the environment value of PS1 is $PWD, not '$PWD'.
(PS1 dosn't have single quote.)
On the other hand, when shell sets PS1="$(pwd)",
double quate are pased and execute pwd command.
So, the environment value of PS1 is /foo/bar/baz .
When shell prints a prompt, shell parses PS1.
If PS1 is $PWD, $PWD is expanded to current directory path.
But if PS1 is /foo/bar/baz ( case set PS1="$(pwd)" ),
PS1 is just /foo/bar/baz. no change.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 09:32 PM
05-17-2004 09:32 PM
Re: what' differenct of ' ' and " " in PS1 enviroment variable?
man sh-posix?
best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2004 04:04 AM - last edited on 09-16-2024 02:22 AM by support_s
05-19-2004 04:04 AM - last edited on 09-16-2024 02:22 AM by support_s
Re: what' differenct of ' ' and " " in PS1 enviroment variable?
- Tags:
- drive