[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] Substituição de variáveis não funciona!
From: |
Rafael Henrique da Silva Correia |
Subject: |
Re: [shell-script] Substituição de variáveis não funciona! |
Date: |
Wed, 27 Feb 2013 10:50:47 -0300 |
Sugestão:
awk '{ print toupper( substr( $0, 1, 1 ) ) substr( $0, 2 ); }' <<< ${var}
Testando.substituicoes
awk -F"." '{ print toupper( substr( $1, 1, 1 ) ) substr( $1, 2 ) "."
toupper( substr( $2, 1, 1 ) ) substr( $2, 2 ) }' <<< ${var}
Testando.Substituicoes
awk '{ print toupper( $1 ) }' <<< ${var}
TESTANDO.SUBSTITUICOES
tr "[:lower:]" "[:upper:]" <<< ${var}
TESTANDO.SUBSTITUICOES
Espero que ajude ai!
Flw!
Em 27 de fevereiro de 2013 10:06, Alfredo Casanova
<address@hidden>escreveu:
> **
>
>
> Estou com um problema com substiuição de variáveis em uma box minha, não
> sei onde está o problema
>
> A box com problema é o terceiro dos exemplos abaixo:
>
> box 1
>
> # bash --version | head -1
> GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)
> # var=testando.substituicoes
> # echo $var
> testando.substituicoes
> # echo ${var^}
> Testando.substituicoes
> # echo ${var^^}
> TESTANDO.SUBSTITUICOES
> # echo ${var~}
> Testando.Substituicoes
>
> box 2
>
> $ bash --version | head -1
> GNU bash, version 4.2.37(1)-release (i486-pc-linux-gnu)
> $ var=testando.substituicoes
> $ echo $var
> testando.substituicoes
> $ echo ${var^}
> Testando.substituicoes
> $ echo ${var^^}
> TESTANDO.SUBSTITUICOES
> $ echo ${var~}
> Testando.Substituicoes
>
> box 3
>
> # bash --version | head -1
> GNU bash, version 4.2.0(1)-release (i686-pc-linux-gnu)
> # var=testando.substituicoes
> # echo $var
> testando.substituicoes
> # echo ${var^}
> -bash: ${var^}: bad substitution
> # echo ${var^^}
> -bash: ${var^^}: bad substitution
> # echo ${var~}
> -bash: ${var~}: bad substitution
>
> funcionou no bash 4.1.5 e no 4.2.37, mas nãof uncionou no 4.2.0
>
> alguma luz?
>
> --
> []'s
> Alfredo Casanova
> Linux User #228230
> msn: address@hidden
> tel: +55 61 9655 9619
>
> [As partes desta mensagem que não continham texto foram removidas]
>
>
>
--
Rafael Henrique da Silva Correia
http://abraseucodigo.com.br
Bacharel em Ciência da Computação
Administrador de Sistemas Linux
Certificado pela LPIC - 101 <http://www.lpi.org/>
Certificado Novell (CLA) <http://www.novell.com/training/certinfo/cla/>
[As partes desta mensagem que não continham texto foram removidas]