shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: duvida em script basico [RESOLVIDO]


From: Timeu F. Oliveira
Subject: Re: duvida em script basico [RESOLVIDO]
Date: Thu, 22 Mar 2007 13:14:45 -0000
User-agent: eGroups-EW/0.82

BOM... na apostila que estou lendo ele n falou sobre o if ainda mas
foi o unico jeito que encontre pra fazer... vai ae o codigo final...

#!/bin/bash
echo "Digite o nome do arquivo ou diretorio:"
read ARQUIVO

if [ -e $ARQUIVO ]
 then echo "Existe"
 else echo "Arquivo Inexistente"
fi

test -d "$ARQUIVO" && echo "e eh um diretorio"
test -f "$ARQUIVO" && echo "e eh um arquivo"

--- Em address@hidden, "Timeu F. Oliveira"
<heathcliff_lnx@...> escreveu
>
> bom o script está assim agora:
> #!/bin/bash
> echo "digite o arquivo:"
> read ARQUIVO
> test -e "$ARQUIVO" && echo "existe"
> test -d "$ARQUIVO" && echo "eh um diretorio"
> test -f "$ARQUIVO" && echo "e eh um arquivo"
> 
> mas... se não existir ele tem q dizer que nao existe... como faz? o.O
> 
> --- Em address@hidden, "Timeu F. Oliveira"
> <heathcliff_lnx@> escreveu
> >
> > olá pessoas... sou novo na lista e estou tentando aprender o shell
> > script... bom... estou tentando fazer um script que identifique se o
> > arquivo ou diretorio existe... em caso positivo escrever se eh arquivo
> > ou diretorio caso nao exista escrever que não existe... bom nisso q
> > postarei abaixo era pra ser a parte de identificar... mas n tah
> > funcionando sendo arquivo ou diretorio ele diz q eh diretorio...
> > 
> > #!/bin/bash
> > echo "digite o arquivo:"
> > read ARQUIVO
> > test $ARQUIVO!=-d && echo "diretorio"
> > exit
> > test $ARQUIVO=-f && echo "arquivo"
> > 
> > ideias?
> >
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]