User Tools

Site Tools


tips:linux:changecase
no way to compare when less than two revisions

Differences

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


tips:linux:changecase [2009/06/08 14:59] (current) – created erik
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