0

I'd like to find a c++ function that (if the program is run from the command prompt) decodes the user's current default prompt string (generally just PS1) and stores it as a string variable.

I found this, but I also found it pretty confusing and am not even sure it's the same question. Any advice?

Community
  • 1
  • 1
Geoffrey
  • 101
  • 2
  • I'm sure this is exactly the same question and the answer unfortunately is: "It is hard and hacky." – pmr Dec 18 '13 at 17:07
  • `getenv("PS1")`? To get it "decoded", you'd have to know what shell the user is using and exactly how the things in `PS1` get expanded, for which there is likely not a single universal solution... – twalberg Dec 18 '13 at 17:59

0 Answers0