liverpole has asked for the wisdom of the Perl Monks concerning the following question:

Sagacious fellow monks,

Having been a huge fan of Unix/Linux over the years, and preferred its command-line power to Windows since, well, forever, I've often toyed with the idea of creating a Perl script to run in a "cmd" window, and mimic some of the more useful constructs of tcsh and bash.  But surely, something like this must have been done already?

I know about Cygwin already, and I've tried googling for similar solutions in Perl, but haven't found anything which worked simply and reliably the way I want it to.  Before setting out to try to create my own, I thought I'd ask whether anyone knows of something that fits the bill.

Of course, I would like to have:

  1. Pass unknown commands directly to the real shell
  2. History (both command-line and ennumerated)
  3. Alias lists (in the style of tcsh)
  4. Variable assignment and substitution
  5. Job control

And as I said, if such a thing exists, please let me know so that I (and others reading) can try it out.

But if there really might be a need for such a tool, and if I decide it's worth embarking on (re)inventing my own version, I would also want to give thought to clever constructs to ease some of the obstacles I always come up against in Windows.

For example, it might be nice to have a construct which, in place of a directory name, creates a mini Tk popup with the user's most commonly accessed directories (and ability to browse any of them), to help choose a directory for the resulting command to cd to, or perform some other command in.

So, can anyone share their relevant ideas on this?

And if you were to design your own ideal Windows filter/shell, what commands might it support?

  • Comment on Has a Windows-based tcsh-like shell been created in Perl yet ...?

Replies are listed 'Best First'.
Re: Has a Windows-based tcsh-like shell been created in Perl yet ...?
by shenme (Priest) on Sep 12, 2005 at 01:39 UTC
    ... and I've tried googling for similar solutions in Perl, but haven't found anything which worked simply and reliably the way I want it to.
    Was one of those Zoidberg?
      No, I hadn't seen Zoidberg before, shenme, but I will check it out now.  And "xie xie ni" (thank you) for your quick response and suggestion!
      I have just tried to install it. A bunch of tests fail. When I force install and run the zoid command I get
      The getpwuid function is unimplemented at C:\Perl\bin\zoid line 83.
      damn it.


      holli, /regexed monk/
        I read through the docs and couldn't get a 'read' on whether the Windows platform was supported. You did the work and got a rude reply for your efforts. Thanks for letting us know.
Re: Has a Windows-based tcsh-like shell been created in Perl yet ...?
by CountZero (Bishop) on Sep 12, 2005 at 06:14 UTC
    There was once Perl Shell, but since its 1.0 release in 2003 not much evolution seems to have been happening.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      version 1.8 is available on CPAN, but its release date was also in Jan 2003.
      I did try psh, as the documentation sounded promising.  Unfortunately, it didn't work well at all, and threw regex exceptions on every command I tried.  But from its writeup, the objectives sounded like what I needed.

      Here's an example of something I'd like a shell to be capable of (and this would be "piece of cake" in Perl) -- allow a history listing mechanism that not only shows last N commands, but lets you search using a regex for matching commands:

      h 15 # Would give the last 15 commands (like "hist +ory 15") h word1 word2 word3 # Would list commands containing all of the g +iven words h /^(vim?|emacs)\b/ # Would list all editing commands (vi, vim, e +macs)
      This kind of task would be perfect for the powerful idioms in Perl!
Re: Has a Windows-based tcsh-like shell been created in Perl yet ...?
by spiritway (Vicar) on Sep 12, 2005 at 04:41 UTC

    I don't know if this is what you're talking about, but there is a bash-like shell available in Windows. It's called msys, and it's available at the <a href="http://www.mingw.org/">MinGW</a> Website. I've used it to compile C and C++ program. It works, but it's not very powerful.

Re: Has a Windows-based tcsh-like shell been created in Perl yet ...?
by parv (Parson) on Sep 12, 2005 at 11:52 UTC

    I wrote a *rough* program to excute chunks of perl code, but was/am stuck on history storage/display. That was until i remembered that there already was such a thing, a perl shell; so i stopped working on it. I had totally forgotten about it until your post today. (Yes, i did the forgetting twice: originally the perl shell, and then my own program.)

    My requirements are much looser, so i think above referenced crab shell should be fine for me.

      Well then, I'm tempted to try writing my own, then, unless there are any better suggestions in the meantime.  Of course, I will post my results on Perlmonks for all to use and/or critique.  Thanks to all who've responded so far!