Enviado em 31/05/2016 - 17:21h
Eu fiz este Shell Script somente para copiar e colar arquivos e funcionava, mas fui adicionando novas funções e por incrível que pareça ele parou de funcionar... Em todos os Scripts que usam o 'dialog', ele não processa os comandos do 'IF', Eu já pesquisei de tudo, coloquei =, ==, -eq, ; em cada comando mas nada funcionou... Alguém sabe dizer por que os comandos do IF não estão sendo executados???
OBS: Fora do 'IF', tem alguns 'clear', eles também não estão sendo executados... Literalmente... só o 'dialog' está sendo processado :/
#Alias Backup
alias BackupShell="dialog --yesno \"Tem certeza que deseja realizar o Backup do Shell?\" 15 60
if [ \"$?\" = \"0\" ]; then
cp ~/.bash_profile ~/.BackupShell
cp ~/.bashrc ~/.Backup Shell
cp ~/.bash_logout ~/.BackupShell
fi
clear"
#Start Custom Comands
#Script 1 - Write and Creating Folder for Backup Shell
if [ ! -d ~/.BackupShell ]; then
mkdir ~/.BackupShell
echo "dialog --yesno \"Tem certeza que deseja realizar o Reckup do Shell?\" 15 60
if [ \"\$?\" = \"0\" ]; then
if [ ! -d ~/.DefaultShell ]; then
mkdir ~/.DefaultShell
cp ~/.bashrc ~/.DefaultShell
cp ~/.bash_profile ~/.DefaultShell
cp ~/.bash_logout ~/.DefaultShell
fi
cp ~/.BackupShell/.bash_profile ~
cp ~/.BackupShell/.bashrc ~
cp ~/.BackupShell/.bash_logout ~
fi clear " >> ~/.BackupShell/BackupScript.sh
chmod +x ~/.BackupShell/BackupScript.sh
fi
#End Script
#Alias Reckup
alias ReckupShell="chmod +x ~/.BackupShell/BackupScript.sh ; cd ~/.BackupShell ; ./BackupScript.sh ; cd ~"
#Alias Excluir Configuracao Backup
alias DelBackupShell="dialog --yesno \"Tem certeza que deseja Excluir as Configuracoes de Backup do Shell?\" 15 60
if [ \"$?\" = \"0\" ]; then
cp ~/.DefaultShell/.bash_profile ~
cp ~/.DefaultShell/.bashrc ~
cp ~/.DefaultShell/.bash_logout ~
rm -rf ~/.DefaultShell
fi
clear"
OBS: Fora do 'IF', tem alguns 'clear', eles também não estão sendo executados... Literalmente... só o 'dialog' está sendo processado :/
#Alias Backup
alias BackupShell="dialog --yesno \"Tem certeza que deseja realizar o Backup do Shell?\" 15 60
if [ \"$?\" = \"0\" ]; then
cp ~/.bash_profile ~/.BackupShell
cp ~/.bashrc ~/.Backup Shell
cp ~/.bash_logout ~/.BackupShell
fi
clear"
#Start Custom Comands
#Script 1 - Write and Creating Folder for Backup Shell
if [ ! -d ~/.BackupShell ]; then
mkdir ~/.BackupShell
echo "dialog --yesno \"Tem certeza que deseja realizar o Reckup do Shell?\" 15 60
if [ \"\$?\" = \"0\" ]; then
if [ ! -d ~/.DefaultShell ]; then
mkdir ~/.DefaultShell
cp ~/.bashrc ~/.DefaultShell
cp ~/.bash_profile ~/.DefaultShell
cp ~/.bash_logout ~/.DefaultShell
fi
cp ~/.BackupShell/.bash_profile ~
cp ~/.BackupShell/.bashrc ~
cp ~/.BackupShell/.bash_logout ~
fi clear " >> ~/.BackupShell/BackupScript.sh
chmod +x ~/.BackupShell/BackupScript.sh
fi
#End Script
#Alias Reckup
alias ReckupShell="chmod +x ~/.BackupShell/BackupScript.sh ; cd ~/.BackupShell ; ./BackupScript.sh ; cd ~"
#Alias Excluir Configuracao Backup
alias DelBackupShell="dialog --yesno \"Tem certeza que deseja Excluir as Configuracoes de Backup do Shell?\" 15 60
if [ \"$?\" = \"0\" ]; then
cp ~/.DefaultShell/.bash_profile ~
cp ~/.DefaultShell/.bashrc ~
cp ~/.DefaultShell/.bash_logout ~
rm -rf ~/.DefaultShell
fi
clear"