Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
typeset not working
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
XST1
Apprentice
Apprentice


Joined: 27 Jan 2004
Posts: 163

PostPosted: Mon Jan 31, 2005 10:21 pm    Post subject: typeset not working Reply with quote

I cant get typeset working for some reason.... heres my script:

Code:

#!/bin/bash

for parameterList in $*
do
   typeset -u parameterList
   echo $parameterList
done



heres the warning I get:

typeset: usage: typeset [-afFirtx] [-p] name[=value] ...

-u should be an argument of typeset (-u is used to turn a string to uppercase and -l should turn a string to lowercase)
Back to top
View user's profile Send private message
ctt
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2005
Posts: 136

PostPosted: Sat Feb 05, 2005 1:55 am    Post subject: Re: typeset not working Reply with quote

XST1 wrote:
I cant get typeset working for some reason.... heres my script:

Code:

#!/bin/bash

for parameterList in $*
do
   typeset -u parameterList
   echo $parameterList
done



heres the warning I get:

typeset: usage: typeset [-afFirtx] [-p] name[=value] ...

-u should be an argument of typeset (-u is used to turn a string to uppercase and -l should turn a string to lowercase)


You appear to be mistaken (based on the warning bash gave you, and bash(1)). As for an alternative, tr can be used to change case:

Code:
#!/bin/bash

upper () {
  echo "$*" | tr [:lower:] [:upper:]
}

for param in "$@"
do
  echo "$(upper $param)"
done


Hope this helps,
_________________
- chris
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum