Link to home
Start Free TrialLog in
Avatar of kiranchandbv
kiranchandbv

asked on

Changing case of a variable


How can I change case of first letter of a variable in shell programming?

#!/bin/sh

$name = "hello"
$name = toTitleCase($name);
echo $name

Is there anything like titleCase or soemthing that will change case of first letter to upper case.

Thanks in advance.


ASKER CERTIFIED SOLUTION
Avatar of Mysidia
Mysidia
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kiranchandbv
kiranchandbv

ASKER

Thanks Mysidia,

I could make it work with small change in the index value in substr.

Thanks again.

name="hello"
echo $name
name=`echo $name |awk '{print toupper(substr($0,1,1))substr($0,2)}'`
echo $name