Embedding a shell script in an AppleScript

Hello All,

I have made this shell script to convert lowercase variables to uppercase variables. Anyone know how i can get this to work in Applescript as a do shell script?? I do not want to call this script from file, I actually want to hard code the script below into the applescript, is this possible? Also CURRENTVAR would be from a variable from the applescript itself.


#!/bin/sh
CURRENTVAR=whatever
UPPER=`echo "${CURRENTVAR}" | tr "[:lower:]" "[:upper:]"`
UPPERCURRENTVAR ="${UPPER}"
echo $newCOPPERVOLUME

Thanks!!

Try this:


set this_value to my conver_to_upper("all caps")

on conver_to_upper(CURRENTVAR)
	return do shell script "echo " & (quoted form of CURRENTVAR) & " | tr '[:lower:]' '[:upper:]'"
end conver_to_upper

on conver_to_lower(CURRENTVAR)
	return do shell script "echo " & (quoted form of CURRENTVAR) & " | tr '[:upper:]' '[:lower:]'"
end conver_to_lower

Jon

That’s perfect, thanks Jonn8!!