Created
March 4, 2018 20:04
-
-
Save shellscriptx/413dd9975bfa39624e70dcca47461ad6 to your computer and use it in GitHub Desktop.
[BAHSRC] Somando e triplicando valores distintos em uma expressão.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
source builtin.sh | |
source regex.sh | |
st_par_impar() | |
{ | |
# par - +10 | |
# impar - *3 | |
[[ $(($1%2)) == 0 ]] && echo $(($1+10)) || echo $(($1*3)) | |
} | |
# Valores | |
chaves='valor: 10, valor: 15, valor: 20, valor: 25, valor: 30, valor: 35, valor: 40, valor: 45, valor: 50' | |
# Aplica as substituições. | |
regex.fnreplace '[0-9]+' "$chaves" -1 $REG_CASE st_par_impar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment