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

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

RES: [shell-script] Problema Script para Adicionar Usuários


From: Rodrigo Vilaça
Subject: RES: [shell-script] Problema Script para Adicionar Usuários
Date: Thu, 23 Sep 2004 13:53:08 -0300


Coloca aspas no teste do if:

if [ $username = "$verusuario" ] ...

Quando a variável verusuario for vazia o shell vai interpretar assim:

[ $username = "" ]

Se não ele interpreta assim:

[ $username = ]

Entendesse o erro?

[]'s
Rodrigo Vilaça



>echo -n "Nome de Usuario: "
>read username
>verusuario=`cat /etc/passwd |cut -d: -f1 | grep "$username"`
>if [ $username = $verusuario ]; then
>        echo "Este usuario ja existe no sistema, processo abortado!"
>        exit 0
>else
>.... prossegue o script

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.725 / Virus Database: 480 - Release Date: 19/07/2004



reply via email to

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