User Tools

Site Tools


tips:linux:changecase

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tips:linux:changecase [2009/06/08 14:59] (current)
erik created
Line 1: Line 1:
 +====== Changing the case of a variable or filename in a shell script ======
  
 +
 +Converting a variable to upper or lower case can be accomplished using **tr**.
 +
 +For example:
 +
 +<​code>​
 +#!/bin/sh
 +LOWER="​erik"​
 +UPPER=`echo $LOWER | tr a-z A-Z`
 +echo $UPPER
 +</​code>​
 +
 +will output:
 +
 +<​code>​
 +ERIK
 +</​code>​
tips/linux/changecase.txt · Last modified: 2009/06/08 14:59 by erik