#!/usr/bin/perl
use strict;
use warnings;

s/\b(PATH)="\$\{\g1\}:(.*?)\"/type -t addToPath | grep -q function | addToPath \"$2\" || $&/;
s/\b(CLASSPATH)="\$\{\g1\}:(.*?)\"/type -t addToPathEnd | grep -q function | addToPathEnd \"$2\" || $&/;

# export "xx=$bb" -> exoprt xx="$bb"
s/(^.*?\bexport\b\s+)"(.*?)=(.*?".*?$)/$1 $2="$3/;

# export XYZ, export XYZ=... 
# -> 
# ifVerboseEcho | grep -q function | ifVerboseEcho XYZ
# export XYZ, export XYZ=...
s/^(.*?)\bexport\b\s+(.*?)=.*?$/$_$1type -t ifVerboseEcho | grep -q function | ifVerboseEcho $2/;
s/^(.*?)\bexport\b\s+(\b.*?\b)$/$_$1type -t ifVerboseEcho | grep -q function | ifVerboseEcho $2/;

#type -t addToPath | grep -q function
