In Ruby, on osx, how can I change the prompt from within a ruby script?
For example,
I'd like a ruby script to run some code and depending on the result, do PS1='\w$ '
. or PS1='\t$ '
i.e.
~ $PS1='\w $'
~ $
~ $PS1='\t $'
20:52:23 $
So as a start I've just tried a script to change the prompt
~/$ cat scripttochangeprompt.rb
`export PS1='\t$ '`
~/$
but it doesn't change the prompt.
~/$ ruby ./scripttochangeprompt.rb
~/$
I can guess that it's creating a new console session to run the command then closing that new console session. But how can I get it to run it in this console session?