3

I've recently started out using powershell. It's a bit hard to get started with but seems powerful enough.

What I am wondering is if there is a github project or equivalent to emulate some of the more useful bash commands and their parameters.

For example, find has a lot of power under the hood, with things like find . -cmin -20 (get files changed in the last 20 minutes). Sure, I created a quick function to do it in the current directory:

function findcmin($cmin=30)
{
    Get-ChildItem . -r | where-object {$_.lastwritetime -gt (get-date).addMinutes(-$cmin)} | Select-Object fullname
}

But is there an existing project that does this type of emulation/porting, with cmin being an option of find? Ditto for wrapping select-string look to make it into a grep lookalike.

There is already some of that built into powershell, that's why ls behaves like get-childitem.

Anyone know of more?

4
  • Nice idea, that made me immediately run a quick check on Github. Results might interest you :) Apart from that: just "more" is a bit broad. Anything specific you want to see covered? Or "as close to the full set as possible"? Any price tag, just in case? – Izzy Dec 16 '16 at 22:06
  • yes, you are right, I could have searched through GitHub. But, as you can see from your own search results, what I have in mind is easier explained than searched for. For example, you have node.js module which obviously has nothing to do with it. That's why I thought of asking here first. The top 10 or so hits (sorted by stars) don't seem all that promising. – JL Peyret Dec 16 '16 at 22:33
  • Agreed: I've posted my comment before I had evaluated the results, and some titles looked more promising than the content behind. If I had asked that question, it would be "a PS module that imitates Bash, so I can have Bash code run by PS" – but it's your question, so I won't rewrite it :) – Izzy Dec 16 '16 at 22:36
  • Can you use Windows 10's built in Bash shell? – Mawg says reinstate Monica Mar 17 '17 at 8:31
1

There used to be the gnuWin32 collection which was Win32 compiled versions of the various textutils, fileutils, coreutils, etc. This is what you are after, I think....

2
  • 1
    Thanks for the suggestion, but no. Really more interested in utilities written in powershell that give a bit more bash power within a powershell environment. For another example, which foo would be neat to have, and it would just require trawling through the path to get most of its functionality. – JL Peyret Dec 16 '16 at 22:27
  • As JL pointed out he's after Powershell modules – not after "anything to run *nix commands". While you can install "anything" on your own machine, you rarely can do that on company machines where you might need to "write stuff that runs on production". Powershell modules are more likely to be accepted in that context. Just one example, and from my perspective – I don't know whether the OPs context might be different :) – Izzy Dec 16 '16 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.