OpenBSD Bash PS1 Prompt Tut. - BSD
Users browsing this thread: 3 Guest(s)
|
|||
This will be a quick tut on making a nice prompt in OpenBSD, for this tutorial I will be using OpenBSD 5.1 and rxvt-unicode.
Note: the things used in this tutorial or strictly for easier learning purposes, I do not use the programs personally. 1. open your .bashrc sudo nano .bashrc. Your Default will look something like this: Code: # $OpenBSD: dot.profile,v 1.4 2005/02/16 06:56:57 matthieu Exp $ First we will add a nice PS1: Code: # Check for an interactive session This will check your current directory add it to the PS1 then check if your in a git repo and add the current branch to the PS1, finally it will add color. It will look something like this: Then we will add a cowsay and colorized ls. sudo pkg_add colorls, sudo pkg_add cowsay If you have yet to set up your package path then do so now, add this to your bashrc Code: export PKG_PATH=ftp;//ftp.openbsd.org/pub/OpenBSD/*your-verison*/packages/*your-architecture* Then add this to your bashrc for the cowsay: Code: # Check for an interactive session Ok so tput is input and cat basically prints a file I tell it to in the terminal, here is a breakdown of tput: tput -input command start setf -set foreground color 1 -color number, in this case 1 is red/orange bold -make bold ; -pause for input fortune -o | cowsay -f blowfish -cowsay command ; -stop input tput - start input sgr0 -clear all input so that the preferences don't run on forever. Alright, now that that is over lets explain the cat. This command: Code: tput setaf 1 bold;cat art;tput sgr0 Does the same as our cowsay input but cat spits out a text file of my choice, the text file I want spit out is an ascii text image I want displayed under my cowsay. This is that image: Code: (~ _ | _ _ _ _ _ _| _|_|_ _ _ | _ Since cat will be printing this it will make a nice effect with my cowsay image, doing this you can make a nice image /W text that matches your color scheme or maybe just matches what you want. Now that we have our .bashrc lined up we can now save and see the things we have added, if you have done everything correctly you should now get a custom PS1 with a custom cowsay colorized to your perfection. You should also now have a colorized ls output since we installed "colorls". Here is our finished prompt: note: Your terminal colors may vary(due to your .Xdefaults). Final Prompt: The Prompt/cowsay is on the right, the colorized ls is on the left. I hope you liked the tutorial, I encourage you all just to use this as a stepping stone and continue to customize to your needs. I would like to add that this should only be a SMALL part of your .bashrc, with more work you can add tons of other things to optimize the shell for your needs. I also do not use bash or nano, I use zsh and vim. |
|||
|
|||
Completely unrelated to the tutorial (shameless bump, I guess):
What font are you using for your terminals? It looks very sharp. |
|||
|
|||
I use Smoothansi for all my term fonts :>
its in the Artwiz pack. |
|||
|
|||
|
|||
|
|||
gbdfed for the win. Making a font with that tool is pretty easy and it compiles on everything with some tweaking.
|
|||
|
|||
|
|||