0

I am currently helping tutor an introductory computer science course in Python. The class is introducing people to programming via the terminal. A common problem I am observing is students are struggling to distinguish the standard $ prompt from the Python >>> prompt.

Out of curiosity, is there a way to recolor specific applications within the terminal by modifying something like $PS1?

I was thinking it might be super helpful if the regular prompt was like white but anything within Python was that dark yellowish color (\e[33m).

fish
  • 441
  • 2
  • 6
  • 15
  • [Like this?](http://stackoverflow.com/q/10953812/645270) – keyser Feb 17 '15 at 23:12
  • Not quite. I found that post but, unless I was misunderstanding it, it seemed that was doing it via a PYTHONSTARTUP file. I was wondering if there was a way to do it straight in the shell. I don't want to change anything about the installation of Python on these computers, just for their users. – fish Feb 17 '15 at 23:50
  • That's true, but I can't say I see the problem with editing the file. – keyser Feb 18 '15 at 11:09
  • Well the other issue is that editing sys.ps1 does not work on Windows or Bash emulators (i.e. GitBash or Cygwin). It does work on true Unix systems though (i.e. Mac and Linux). – fish Feb 19 '15 at 23:34

1 Answers1

0

You can edit this using sys.ps1 and sys.ps2. ps1 changes the >>> prompt, while ps2 changes the continuation ... prompt. You can get (hardly) more information here.

Spice
  • 352
  • 1
  • 5
  • If I understand this correctly, to make this change permanent, you need to change the PYTHONSTARTUP file? Is that correct? – fish Feb 18 '15 at 00:12