I'd like to have two commands - the first to short the prompt to $␣
or #␣
.
This should be permanent in the current shell, until I issue the command long_prompt
to reset the prompt to the default version.
This is the short_prompt
command script:
if [ $(id -u) = 0 ]; then
PS1='\[\033[01;34m\]#\[\033[00m\] '
else
PS1='\[\033[01;34m\]\$\[\033[00m\] '
fi
(As you see I honor the different prompts of admin shells and user shells)
When I source this script with like so:
$ . short_prompt
all works as expected, but for this I have to be in the directory where short_prompt
resides or give the whole pathname, like so:
$ . /data/system/bin/short_prompt
I can't seem to figure out how to make this command accessible from anywhere (e.g. by creating a soft link to one of the path directories, e.g. /usr/local/bin
) and type
$ short_prompt
or
$ long_prompt
I tried to add export
in front of the two PS1='...'
lines, but that did not work either.
~/.bashrc
? See the manual page of Bash. Defineshort_prompt
andlong_prompt
as functions or aliases.