LIXEIRA COMPLETA!
Publicado por Rodney Elias 18/01/2004
[ Hits: 5.777 ]
Esse script 'lix.sh' deve ser utilizado juntamente com o script 'rescue.sh', pois, o primeiro é responsável para que o arquivo seja enviado para uma pasta especial e o segundo para que, caso necessário, o arquivo seja restaurado para o seu PATH original. Assim, utilize o 'lix.sh' e o 'rescue.sh'.
#!/bin/bash LIX=/LIXEIRA TMP=$LIX/.swp ARQ=$LIX/.list if ! [ -d $LIX ]; then mkdir $LIX; chmod 0555 $LIX; fi clear; if [ "$#" != "1" ]; then clear; echo -e "\n\tEsta versao permite somente um argumento...\n"; exit 1; elif [ -e $1 -a -e "$LIX/$(basename $1)" ]; then echo -e "\t'$LIX' ja possui um arquivo '$(basename $1)'...\n"; echo -e "\tDeseja sobrescrever '$(basename $1)'? [yes/no]: \c"; read conf; until [ "$conf" = "yes" -o "$conf" = "no" ]; do clear; echo -e "\n\tDigite uma opcao valida...\n"; echo -e "\n\tDeseja sobrescrever '$(basename $1)'? [yes/no]: \c"; read conf; done if [ "$conf" = "yes" ]; then if [ "$(dirname $1)" = "/" ]; then echo $1 >> $TMP; mv -f $1 $LIX; elif [ "$(dirname $1)" = "." -a "$PWD" = "/" ]; then echo /$1 >> $TMP; mv -f $1 $LIX; elif [ "$(dirname $1)" = "." ]; then echo $PWD/$1 >> $TMP; mv -f $1 $LIX; else echo $1 >> $TMP; mv -f $1 $LIX; fi grep -vw $(basename $1) $ARQ >> $TMP; mv -f $TMP $ARQ; elif [ "$conf" = "no" ]; then clear; echo -e "\n\tRenomeie '$1'...\n"; exit 0; fi elif [ -e $1 ]; then echo -e "\nGostaria de enviar '$1' para a lixeira? [yes/no]: \c"; read resp; until [ "$resp" = "yes" -o "$resp" = "no" ]; do clear; echo -e "\n\tDigite uma opcao valida...\n"; echo -e "\n\tGostaria de enviar '$1' para a lixeira? [yes/no]: \c"; read resp; done if [ "$resp" = "yes" ]; then if [ "$(dirname $1)" = "/" ]; then echo $1 >> $ARQ; mv -f $1 $LIX; elif [ "$(dirname $1)" = "." -a "$PWD" = "/" ]; then echo /$1 >> $ARQ; mv -f $1 $LIX; elif [ "$(dirname $1)" = "." ]; then echo $PWD/$1 >> $ARQ; mv -f $1 $LIX; else echo $1 >> $ARQ; mv -f $1 $LIX; fi elif [ "$resp" = "no" ]; then rm -fr $1; fi else clear; echo -e "\n\t'$1' nao existe...\n"; exit 1; fi
Renomeador Automático de Arquivos de Mídia
Alterar temas GTK individualmente
Nenhum comentário foi encontrado.
Resolver problemas de Internet
Como compartilhar a tela do Ubuntu com uma Smart TV (LG, Samsung, etc.)
Descritores de Arquivos e Swappiness
Como instalar no Linux Jogos da Steam só para Windows
Instalando o Team Viewer no Debian Trixie - problema no Policykit
O Que Fazer Após Instalar Ubuntu 25.04