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 [email protected], "Timeu F. Oliveira" <[EMAIL PROTECTED]> 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 [email protected], "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? > > >
