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

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

Re: RES: [shell-script] acrescentar caracter


From: caio ferreira
Subject: Re: RES: [shell-script] acrescentar caracter
Date: Mon, 02 Aug 2004 12:12:27 -0300
User-agent: Mozilla Thunderbird 0.5 (X11/20040306)

Pedro Henrique Ponchio wrote:
caio, pra verificar se está vazio, poderia rodar algo do tipo:

VARIAVEL="sei_la"
if [ "`awk -F ":" '{ print $3 }' arquivo`" = "" ] ; then CAMPO="vazio" ; else 
CAMPO="cheio" ; fi
if [ $CAMPO = vazio ] ; then sed "s/::/:$VARIAVEL:/" arquivo > arquivo2 ; fi

O campo referente a senha sempre vai estar vazio. Executando a parte referente a $CAMPO=vazio e mesmo assim nao deu certo. As senhas sao geradas, mas o campo continua vazio no arquivo2

        O script esta assim :

# Declarando variaveis
WORKDIR=/root/scripts/users
HOMEDIR=/home
USERSFILE=teste.db
CUT=/usr/bin/cut

# for each user listed
for EACHUSER in `grep -v "#" $WORKDIR/$USERSFILE` ; do

   # garar senha
   PASSWORD= makepasswd --chars 8 --string abcdefghijklmnopqrstuvwxyz1234567890

   # acrescentar senha no teste.db
   sed "s/::/:$PASSWORD:/" $USERSFILE > arquivo2

done


reply via email to

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