Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'd like to mess with my Bash prompt, but I'd like to do so in a way that doesn't corrupt my already extant one. I could just comment it out, but is there a way to test it either with an online tool or a CLI tool?

share|improve this question
3  
Define "commit". The easiest way for me is to just start a new shell. Then if I screw it up I can just exit it and no permanent changes have been made. –  jw013 Dec 20 '12 at 21:11
    
I guess I'm looking for a web tool to test them quickly without starting a terminal. –  Naftuli Tzvi Kay Dec 20 '12 at 21:13
4  
I don't really see why anything outside the terminal would be handier? –  Bernhard Dec 20 '12 at 21:16
    
A web tool sounds like even more of a pain than starting a new shell, unless you want to play around with bash when not on a Unix machine. Is that your goal (a web-based bash)? –  jw013 Dec 20 '12 at 21:18
    
Simply start a new shell by typing sh and test your new PS1 there. Puh, that was hard. –  ott-- Dec 20 '12 at 21:18

2 Answers 2

up vote 1 down vote accepted

You could create a file with your "new prompt" tweaks and then source it from the command line.

 vim new_prompt.bash
 source ./new_prompt.bash

The new prompt will only be active in that shell. If you open a new shell, your old prompt will be sourced and set.

When you are ready to 'commit' the new prompt, just add it to your bash initialization scripts.

EDIT:

I also just found this online bash prompt preview. I don't know what version of bash it's based on.

share|improve this answer

You could change PS1 and others to a different value, if you don't like it don't add it to your .bashrc

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.