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

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

Re: [shell-script] debbug


From: caio ferreira
Subject: Re: [shell-script] debbug
Date: Thu, 12 Aug 2004 14:37:17 -0300
User-agent: Mozilla Thunderbird 0.5 (X11/20040306)

Victor Leonardo wrote:
Por acaso alguem saberia me dizer se existe algum software para fazer debug de um shell-script ?!?!? Eh que eu estou com um problema em um script que nao ha meio de conseguir resolver.

> Tente utilizar: bash -xv nome_do_script 2> /tmp/debug
> O arquivo debug irá conter os comandos executados no script e os
> resultados obtidos.

bash -xv teste.sh 2> teste.debug

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

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

  # garar senha
  PASSWORD=$(makepasswd --chars 8 --string abcdefghijklmnopqrstuvwxyz1234567890)

  sed "s|::|:${PASSWORD}:|" $USERSFILE > arquivo-novo

done

grep -v "#" $WORKDIR/$USERSFILE
++ grep -v '#' /root/scripts/users/teste.db
makepasswd --chars 8 --string abcdefghijklmnopqrstuvwxyz1234567890
++ makepasswd --chars 8 --string abcdefghijklmnopqrstuvwxyz1234567890
+ PASSWORD=iw1o7348
+ sed 's|::|:iw1o7348:|' teste.db
makepasswd --chars 8 --string abcdefghijklmnopqrstuvwxyz1234567890
++ makepasswd --chars 8 --string abcdefghijklmnopqrstuvwxyz1234567890
+ PASSWORD=1gsfgta2
+ sed 's|::|:1gsfgta2:|' teste.db

        Conteudo do arquivo-novo

#  LOCALNAME : LOCALGROUP : PASSWD : DEFAULTSHELL
user1:empresa:1gsfgta2:/bin/bash
user2:empresa:1gsfgta2:/bin/bash

        Eu nao estou tentendendo por que eh que ele esta gravando a mesma senha.


reply via email to

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