Merge branch 'main' of https://git.galoz.site/galoz/proxy
This commit is contained in:
24
set_ps1.sh
Normal file
24
set_ps1.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define the new PS1 string
|
||||
# Example: [User@Host CurrentDir]$
|
||||
# This example uses colors: green for user@host, blue for directory.
|
||||
# \u: username
|
||||
# \h: hostname (short)
|
||||
# \w: current working directory (basename only)
|
||||
# \$: # if root, $ otherwise
|
||||
NEW_PS1='\[\e[1m\]\[\e[90m\]0\[\e[0;32m\]\u@\[\e[36m\]\h\[\e[90m\]:\[\e[33m\]\w\[\e[90m\]$ \[\e[m\]'
|
||||
|
||||
# The line to be added to .bashrc
|
||||
PS1_LINE="PS1='${NEW_PS1}'"
|
||||
|
||||
# Check if the line already exists in .bashrc to prevent duplicates
|
||||
if grep -qE "^PS1=" ~/.bashrc; then
|
||||
echo "PS1 setting already exists in ~/.bashrc. No changes made."
|
||||
else
|
||||
# Append the PS1 line to .bashrc
|
||||
echo -e "\n" >> ~/.bashrc # Ensure there's a newline before adding
|
||||
echo "${PS1_LINE}" >> ~/.bashrc
|
||||
echo "PS1 setting has been added to ~/.bashrc."
|
||||
echo "Please open a new terminal or run 'source ~/.bashrc' for changes to take effect."
|
||||
fi
|
||||
Reference in New Issue
Block a user