Considere os scripts a seguir:
script.sh
#!/bin/bash
# Salva os argumentos posicionais.
var=$*| #!/usr/bin/env bash | |
| # XXX INFO XXX | |
| # A conexão ssh precisa ser feita via 'sshpass' ou 'Chave RSA' | |
| # Requer pacote imagemagick instalado. | |
| # Importando API | |
| source ShellBot.sh | |
| # Token do bot |
| #!/usr/bin/env bash | |
| # Atribuindo valores manualmente | |
| var1=10 | |
| var2=20 | |
| var3=30 | |
| var4=40 | |
| var5=50 | |
| # Sufixo da variável. |
| #!/bin/bash | |
| # Função de escape (markdown) | |
| esc(){ | |
| local str=$1 | |
| # Caracteres: *_`][ | |
| str=${str//\*/\\*} | |
| str=${str//_/\\_} | |
| str=${str//\`/\\\`} |
| #!/bin/bash | |
| # | |
| # Importando API | |
| source ShellBot.sh | |
| # Token do bot | |
| bot_token='<TOKEN_AQUI>' | |
| # Inicializando o bot |
| #!/bin/bash | |
| # Importando API | |
| source ShellBot.sh | |
| # Token do bot | |
| bot_token='<TOKEN_AQUI>' | |
| # Inicializando o bot | |
| ShellBot.init --token "$bot_token" --monitor --return map |
| #!/bin/bash | |
| # | |
| # Importando API | |
| source ShellBot.sh | |
| # Token do bot | |
| bot_token='<TOKEN_AQUI>' | |
| # Inicializando o bot | |
| ShellBot.init --token "$bot_token" --monitor --flush --return map |
Considere os scripts a seguir:
script.sh
#!/bin/bash
# Salva os argumentos posicionais.
var=$*arq.txt
name; SITE1
url; www.site1.com.br
username name;
username; usuario1
password; senha
extra;
| #!/bin/bash | |
| # Lê arquivo. | |
| conteudo=$(< arq1.yaml) | |
| # Grupo | |
| re='([a-zA-Z0-9_]+)' | |
| # Lê o contéudo enquanto houver variáveis. | |
| # |
Função
ver_log()
{
while read -r linha; do
IFS=' ' read _ _ hora _ <<< $linha
[[ $hora = $1 || $hora = $2 ]] ||
[[ $hora > $1 && $hora < $2 ]] && echo "$linha"
done < arq.log