heinous attempt to port powershell to *nix shell