[Novalug] bash question

James Ewing Cottrell III JECottrell3@Comcast.NET
Tue Aug 12 01:45:37 EDT 2014


Hmmmm, never heard of <<< before...looked it up...you learn something 
new every day.

Then again, seems like you've never heard of declare:

declare -l lowercase=$mixed_case
declare -u uppercase=$mixed case

JIM

On 8/11/2014 5:18 PM, Pete Nuwayser via Novalug wrote:
> looking for some community WD-40 to get the rust out :)
>
> I'm pulling user-data from an AWS instance like this:
> read var1 var2 var3 <<< $(curl --silent http://169.254.169.254/latest/user-data)
>
> where the data is already set as three space-separated parameters.
>
> I now want to convert the contents of these three variables to
> lowercase. I could do it like this:
> var1="$(tr "[A-Z]" "[a-z]" <<< "$var1")"
> var2="$(tr "[A-Z]" "[a-z]" <<< "$var2")"
> var3="$(tr "[A-Z]" "[a-z]" <<< "$var3")"
>
> but I'd rather use some kind of for loop. several experiments and
> searches for how to do the proper substitution have failed me. any
> thoughts? I'm not married to using tr - it just needs to be able to
> run in a bash script. TIA
>
> Pete
> **********************************************************************
> The Novalug mailing list is hosted by firemountain.net.
>
> To unsubscribe or change delivery options:
> http://www.firemountain.net/mailman/listinfo/novalug
>




More information about the Novalug mailing list