Created
July 15, 2018 19:41
-
-
Save carlosanders/149346077b18c7d2bad7a7e6adab3965 to your computer and use it in GitHub Desktop.
Alterando o PS1 do bash do Oracle Linux 7 ou do Ubuntu
This file contains hidden or 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 | |
| # Script Autor: 1T (T) Anders | |
| ########################################################################### | |
| ########################################################################### | |
| ########################################################################### | |
| ver_so=`cat /etc/oracle-release` | |
| usuario_logado=$USER | |
| # Rotina principal do script e chamada na ordem abaixo do arquivo | |
| main() { | |
| echo -e "\033[01;47;31m>>>>>>>> Servidor: ${ver_so} <<<<<<<<\033[00m" | |
| config_bash_go | |
| echo -e '\033[00;47;31m----- Provisionamento Concluído ----- \033[00m' | |
| } | |
| #sub-rotina de configuração no bash do oracle/ubuntu | |
| config_bash_go() { | |
| echo -e '\033[01;33m>>>>>>>> Configurando o bash do SO <<<<<<<<\033[00m' | |
| bash_profile_file_geral="/etc/profile" | |
| profile_vagrant_file="/home/${usuario_logado}/.bashrc" | |
| profile_root_file="/root/.bashrc" | |
| PS1='\[\033]0;$TITLEPREFIX:${PWD//[^[:ascii:]]/?}\007\]\n\[\033[40;36m\][\A] \[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM\[\033[33m\]\w\[\033[36m\]\[\033[0m\]\n$ ' | |
| echo "$PS1" | |
| sudo echo "export PS1='${PS1}'" >> ${profile_vagrant_file} | |
| sudo echo "export PS1='${PS1}'" >> ${profile_root_file} | |
| cat << EOF >> ${bash_profile_file_geral} | |
| PS1='${PS1}' | |
| export PS1 | |
| EOF | |
| echo -e '\033[00;36m----- Concluído ----- \033[00m' | |
| } | |
| main | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment