Posts Tagged bash
Colored prompt on bash console
It can be nice to have different color prompt on the terminal screen to differentiate different login. the following code simply set up PS1 to have yellow prompt on the terminal screen, which can be appended in your .bash_profile
# set our custom yellow prompt
PS1=’\[33[1;33m\]\u\[33[1;37m\]@\[33[1;33m\]\h\[33[1;37m\]:\[33[1;33m\]\W \[33[1;33m\]\$ \[33[0m\]‘
# set our custom red prompt to visually identified root
PS1=’\[33[1;31m\]\u\[33[1;37m\]@\[33[1;31m\]\h\[33[1;31m\]:\[33[1;31m\]\W \[33[1;31m\]\$ \[33[0m\]‘
Keep Oracle SID’s handy
A trick to always keep andy all SID’s of all the different DB instance in your system’s can belike the following script.
I recommend to save into a separate text file (say orasids.sh) in your oracle $HOME directory and source from .bash_profile as its last line: or in alternatives, you can source at any time as follows
# source orasids.sh
Of course this file must be chown’ed 750.
#!/bin/bash
#
function showsid () { echo -en “ORACLE_SID: $ORACLE_SID\n” ;};
function db01test () { export ORACLE_SID=db01test; showsid ;};
function prod () { export ORACLE_SID=prod; showsid ;};
function nosid () { unset ORACLE_SID; showsid ;};
showsid
#
# end-of-file