See this recent discussion about mirroring your shell environment in Keyboard Maestro.
For more information, see the wiki Searching the Forum for Answers section.