• Post Reply Bookmark Topic Watch Topic
  • New Topic

Shell script  RSS feed

 
Jackie Wang
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my program, I had the syntax error when I ran it:

set location = "CalIfORnIa"
set location2 = tolower(location)

any one have clue ?
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a) no blanks around equals:
set location="myAmiBeach"
b) variable not used:
set location2=tolower($location)
 
Jackie Wang
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It still have syntax error:

However, if I try this:
set country = "ABcdE"
set countrylow = `tolower($country)`

It's prompting me that Badly place()'s

Please help! thanks!
 
Dillip Mohapatra
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should try as follows

set country = "ABcdE"
set countrylow = `echo $country|tr '[A-Z]' '[a-z]'`

Regards
Dillip
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which shell do you use?
ksh, sh, bash, tsh, ash, ...
 
Dillip Mohapatra
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are concerned with shell,
then use bash

and in stead of "set" use "export".

Ok...I did thought that you have doubt about shell, but didn't mention
anything, as I thought the conversion perhaps more bothering you than
the shell itself.
 
Jackie Wang
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot guys:

That's from my console:

root> echo $shell
/usr/bin/tcsh

however, I found this when I run the script:
[A-Z][a-z]: Command not found

and my $countrylow contains blank
Any clue?
Thanks a lot!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!