Enviado em 26/09/2012 - 10:08h
Olá, eu estou tentando fazer o seguinte:Enviado em 27/09/2012 - 12:19h
#!/bin/sh #Valores padrões para comando sem argumento DIR="." SIZE=1000 #Argumentos de diretorio e tamanho if test -n "$1"; then DIR=$1; fi; if test -n "$2"; then SIZE=$2; fi; echo Finding Backup Files in $DIR bigger than $SIZE KB FILES=`find ${DIR} -size +${SIZE} |sed -e "s/ /?/g"` if test -n '$FILES'; then ls -l $FILES; else echo "No files found"; fi;
#!/bin/sh #Valores padrões para comando sem argumento DIR="." SIZE=1000 #Argumentos de diretorio e tamanho if test -n "$1"; then DIR=$1; fi; if test -n "$2"; then SIZE=$2; fi; echo Finding Backup Files in $DIR bigger than $SIZE KB FILES=$(find ${DIR} -size +${SIZE} |sed -e "s/ /?/g") if test -n '$FILES'; then ls -l $FILES; else echo "No files found"; fi;
Enviado em 27/09/2012 - 16:55h
Tu é pika, neguinho, mas se liga:Enviado em 27/09/2012 - 17:35h
#!/bin/sh #Valores padrões para comando sem argumento DIR="." SIZE=1000 #Argumentos de diretorio e tamanho if test -n "$1"; then DIR=$1; fi; if test -n "$2"; then SIZE=$2; fi; echo Finding Backup Files in $DIR bigger than $SIZE KB FILES=$(find ${DIR} -maxdepth 1 -size +${SIZE} |sed -e "s/ /?/g") if test -n '$FILES'; then ls -l $FILES; else echo "No files found"; fi;
Enviado em 27/09/2012 - 17:52h
boa, cara! O maxdepth resolveu a questão do recursivo.Enviado em 27/09/2012 - 18:15h
#!/bin/sh #Valores padrões para comando sem argumento DIR="." SIZE=1000 #Argumentos de diretorio e tamanho if test -n "$1"; then DIR=$1; fi; if test -n "$2"; then SIZE=$2; fi; echo Finding Backup Files in $DIR bigger than $SIZE KB FILES=$(find ${DIR} -maxdepth 1 -size +${SIZE}k |sed -e "s/ /?/g") if test -n "$FILES"; then ls -l $FILES; else echo "No files found"; fi;
Enviado em 28/09/2012 - 11:16h
Cara, Leandro, tentei com k(b), K(B), colado na variável, com espaço... nada funcionou. Continua retornando o resultado de "ls -l".Enviado em 28/09/2012 - 11:24h
Dei uma lida no manual do find e alterei a parte do size. O resultado é o mesmo, mas como quero esse script para ver arquivos realmente grandes, acho que assim fica mais visualmente limpo:#!/bin/sh #Valores padrões para comando sem argumento DIR="." SIZE=40 #Argumentos de diretorio e tamanho if test -n "$1"; then DIR=$1; fi; if test -n "$2"; then SIZE=$2; fi; echo Finding Backup Files in $DIR bigger than $SIZE MB FILES=$(find ${DIR} -maxdepth 1 -size +${SIZE}M |sed -e "s/ /?/g") if test -n '$FILES'; then ls -l $FILES; else echo "No files found"; fi;
Enviado em 28/09/2012 - 16:49h
Eu dei uma ligeira modificada no script. Teste este:#!/bin/sh #Valores padrões para comando sem argumento DIR="." SIZE="40" #Argumentos de diretorio e tamanho if test -n "$1"; then DIR=$1 fi if test -n "$2"; then SIZE=$2 fi echo "Finding Backup Files in $DIR bigger than $SIZE MB" FILES=$(find "$DIR" -maxdepth 1 -size +"$SIZE"M | sed -e "s/ /?/g") if test -n "$FILES" ; then ls -l $FILES else echo "No files found" fi exit 0
Enviado em 28/09/2012 - 17:36h
Parabéns Mlk! Acertou na mosca! Obrigado pela ajuda. Abcs.#!/bin/sh #Valores padrões para comando sem argumento DIR="." SIZE="40" #Argumentos de diretorio e tamanho if test -n "$1"; then DIR=$1 fi if test -n "$2"; then SIZE=$2 fi echo "Finding Backup Files in $DIR bigger than $SIZE MB" FILES=$(find "$DIR" -maxdepth 1 -size +"$SIZE"M | sed -e "s/ /?/g") if test -n "$FILES" ; then ls -l $FILES else echo "No files found" fi exit 0
#!/bin/sh #Valores padrões para comando sem argumento DIR="." SIZE="1" #Argumentos de diretorio e tamanho if test -n "$1"; then DIR=$1 fi if test -n "$2"; then SIZE=$2 fi echo "Finding Backup Files in $DIR bigger than $SIZE MB" FILES=$(find "$DIR" -maxdepth 1 -size +"$SIZE"M | sed -e "s/ /?/g") if test -n "$FILES" ; then echo "there are files to remove" rm -rv $FILES else echo "No files found" fi echo "Nothing else to do. Thanks for using me" exit 0
Como gerar qualquer emoji ou símbolo unicode a partir do seu teclado
Instalar e Configurar o Slackware Linux em 2025
Como configurar os repositórios do apt no Debian 12 em 2025
Passkeys: A Evolução da Autenticação Digital
Instalação de distro Linux em computadores, netbooks, etc, em rede com o Clonezilla
Muitas dificuldades ao instalar distro Linux em Notebook Sony Vaio PCG-6131L (VPCEA24FM)
Slackpkg+ (Slackpkg Plus) está de volta!
Como dividir duas janelas igualmente e lado-a-lado na sua tela
Configurando o Conky para iniciar corretamente no sistema
3 configurações básicas que podem melhorar muito a sua edição pelo editor nano
Youtube e networkmeneger para de funcionar (0)
Minha rede tem um espaço invisível que não dá pra digitar o nome da re... (1)
Pedagogia no brasil não passa de alfabetização por m4sturbação mental ... (2)
compilação samba 4.22 rock linux 9.5 (3)
Erro de segmentação «Segmentation fault (core dumped)» ao retornar obj... (7)