Last active
May 9, 2024 05:10
-
-
Save tsengia/be3d99c8222d924925cb9513ea879e21 to your computer and use it in GitHub Desktop.
Temporarily configure a custom terminal prompt with specified host info and relative directory status.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# NOTE: Tested on Kubuntu 24.04, using bash 5.2.21 | |
host_info="${1}" | |
relative_dir="${2}" | |
if [ -z $relative_dir ]; then | |
relative_dir=$(dirname "${PWD}") | |
fi | |
prompt=$(echo '"${debian_chroot:+($debian_chroot)}\[\033[01;32m\]') | |
prompt+=${host_info} | |
prompt+=$(echo '\[\033[00m\]:\[\033[01;34m\]~\${PWD#') | |
prompt+=${relative_dir} | |
prompt+=$(echo '}\[\033[00m\]\$ "') | |
bash --rcfile <(cat ~/.bashrc; echo PS1="${prompt}" ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment