Created
May 1, 2012 16:13
-
-
Save ataliba/2569253 to your computer and use it in GitHub Desktop.
Somente para histórico - zzinverte - inverte uma string ( faz o mesmo que a zzvira, que eu não conhecia )
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
# ---------------------------------------------------------------------------- | |
# Inverte a string passada como parâmetro para o comando | |
# Uso: zzinverte | |
# Ex.: zzinverte string | |
# | |
# Autor: Ataliba Teixeira, www.ataliba.eti.br | |
# Desde: 2012-04-30 | |
# Versão: 1 | |
# Licença: GPL | |
# ---------------------------------------------------------------------------- | |
zzinverte () | |
{ | |
zzzz -h inverte "$1" && return | |
echo $1 | awk '{ for(i=length($0);i>=1;i--) printf("%s",substr($0,i,1)); }' | |
echo | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment