Created
April 2, 2019 01:03
-
-
Save carlosanders/5527d710fe833d25c80e344436f8b3b5 to your computer and use it in GitHub Desktop.
Configurar o $PS1 e add data ao history no OEL 7.4+
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 | |
# Script Autor: 1T (T) Anders | |
########################################################################### | |
########################################################################### | |
########################################################################### | |
ver_so=`cat /etc/oracle-release` | |
#usuario_logado=$USER | |
usuario_logado=admin | |
# 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 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[01;34m\][\D{%d.%m.%Y}] \[\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} | |
sudo cat << EOF >> ${bash_profile_file_geral} | |
PS1='${PS1}' | |
export PS1 | |
EOF | |
#alterando o historico para exibir a data do comando | |
#echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile | |
echo 'export HISTTIMEFORMAT="%d.%m.%y %H:%M "' >> ~/.bash_profile | |
source ~/.bash_profile | |
source ${profile_vagrant_file} | |
source ${profile_root_file} | |
source ${bash_profile_file_geral} | |
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