-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatualizar
executable file
·37 lines (32 loc) · 1.01 KB
/
atualizar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
set -eu
export AQUI=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "Aqui: '$AQUI'"
find "$AQUI" -type d | grep -v .git | while read diretorio; do
case "$diretorio" in
*\ * )
echo "erro: existem caminhos com espaço aqui. Ex: '$diretorio'"
exit 1
;;
esac
done
if [ $# -eq 0 ]; then
find "$AQUI" -type f | grep -e '/atualizar.sh' | cut -c $((${#AQUI}+2))- | while read atualizador; do
dirname $atualizador
done
else
while [ $# -gt 0 ]; do
echo $1; shift
done
fi | while read pasta_para_procurar; do
export ALI="$AQUI/$pasta_para_procurar"
pushd "$ALI" > /dev/null
if [ -f "$ALI/atualizar.sh" ]; then
bash "$ALI/atualizar.sh" 2>&1 | while read linha; do
echo "$pasta_para_procurar: $linha" # bota um prefixo a cada linha
done
else
echo "'$ALI/atualizar.sh' não foi encontrado, pulando..."
fi
popd > /dev/null
done