lonepie
October 13th, 2006, 04:36 PM
Greetings all! I recently put together a small program that you can use to simplify the process of customizing your bash prompt. I always got confused writing the escape sequences by hand, so I created this handy tool that converts a simplified string (from what I call the "wizard") into the escape sequences needed by bash. Along with this conversion, a preview is also generated so you can see what your prompt will look like!
I wrote this in C# using monodevelop, so you must have the Mono and gtk-sharp runtime libraries installed. Also, I'm fairly new to programming on Linux, so let me know if there are any problems with the program.
I've attatched a .deb of the program; you can also get the source from my Google Code SVN by using the following command: svn checkout http://bunchafunk.googlecode.com/svn/trunk/bashpromptutil/ bashpromptutil
To install using the attatched file, execute the following in your command line:
cd /download/dir
tar zxvf bashpromptutil_1.0b-1_i386.tar.gz
sudo dpkg -i bashpromptutil_1.0b-1_i386.deb
To compile and install the source from the svn repository, assuming you've checked out the code, execute the following: (tested and working with automake-1.9, but not working with automake-1.4)
cd /downloaddir/bashpromptutil
./autogen.sh (note if you want to install in somewhere other than /usr/local, run ./configure with the --prefix argument)
make
sudo make install
Once you have the program installed, run it by typing "bashpromptutil" at your command prompt or by using ALT+F2. The user interface is fairly simple to understand: you construct your bash prompt with the simplified syntax in the "(Wizard Input)" box. To insert a color or item, go to the "Wizard" menu to select one. The item will then appear in the "Wizard" box, in the form: {color} or <item>. You can also input regular characters or strings, for example the @ sign in: <username>@<hostnameS>
Here is an example of the syntax you would use in the wizard:
{color1}<item1><item2> {color2}- {color3}<item3>{default}<item4> In english: items 1 and 2 will be color1, the "-" will be color2, item3 will be color3, and item4 will have the default color. Note you should always end with the default color to prevent your whole command line from being colored.
If you are satisfied with how the prompt looks, you can make the changes permanent by adding the following to your /home/*user*/.bashrc file:
#
PS1="output from bashpromptutil"
*thanks HAARP*
(Make sure to comment out any other places in .bashrc where PS1 is set/assigned)
If you have any questions or comments, let me know!
Enjoy!
Note: if you do not have the Mono runtime installed, you can get it from the Ubuntu apt repository using Synaptic. You may have to have the universe and multiverse repos enabled in your sources.list.
I wrote this in C# using monodevelop, so you must have the Mono and gtk-sharp runtime libraries installed. Also, I'm fairly new to programming on Linux, so let me know if there are any problems with the program.
I've attatched a .deb of the program; you can also get the source from my Google Code SVN by using the following command: svn checkout http://bunchafunk.googlecode.com/svn/trunk/bashpromptutil/ bashpromptutil
To install using the attatched file, execute the following in your command line:
cd /download/dir
tar zxvf bashpromptutil_1.0b-1_i386.tar.gz
sudo dpkg -i bashpromptutil_1.0b-1_i386.deb
To compile and install the source from the svn repository, assuming you've checked out the code, execute the following: (tested and working with automake-1.9, but not working with automake-1.4)
cd /downloaddir/bashpromptutil
./autogen.sh (note if you want to install in somewhere other than /usr/local, run ./configure with the --prefix argument)
make
sudo make install
Once you have the program installed, run it by typing "bashpromptutil" at your command prompt or by using ALT+F2. The user interface is fairly simple to understand: you construct your bash prompt with the simplified syntax in the "(Wizard Input)" box. To insert a color or item, go to the "Wizard" menu to select one. The item will then appear in the "Wizard" box, in the form: {color} or <item>. You can also input regular characters or strings, for example the @ sign in: <username>@<hostnameS>
Here is an example of the syntax you would use in the wizard:
{color1}<item1><item2> {color2}- {color3}<item3>{default}<item4> In english: items 1 and 2 will be color1, the "-" will be color2, item3 will be color3, and item4 will have the default color. Note you should always end with the default color to prevent your whole command line from being colored.
If you are satisfied with how the prompt looks, you can make the changes permanent by adding the following to your /home/*user*/.bashrc file:
#
PS1="output from bashpromptutil"
*thanks HAARP*
(Make sure to comment out any other places in .bashrc where PS1 is set/assigned)
If you have any questions or comments, let me know!
Enjoy!
Note: if you do not have the Mono runtime installed, you can get it from the Ubuntu apt repository using Synaptic. You may have to have the universe and multiverse repos enabled in your sources.list.