Not knowing what to do with my psh

psh, or the Perl shell, is supposed to be, among other things, a kind of “immediate mode” for perl code segments, as well as a way of injecting Perl commands and syntax into other shells such as bash.

It is always a bit ambitious at the best of times, to install anything from source into a Cygwin installation. Cygwin lacks much of the trappings of a full UNIX installation, which is understandable, having to run on top of MS-Windows. But Cygwin does support X-Windows and subsequently big-ticket window managers like Mate or Gnome, and also Java when you unpack it. It supports GCC, perl, and many of your other favourite open source languages.

The source for psh was downloaded from GitHub, and I downloaded the ZIP file for it in an empty directory.

I had to install psh as root (actually admin, because Windows), before running it with my joeuser account. When it ran, I observed that it actually re-ran the incumbent shell, and really had no actual shell of its own that would result in its own prompt style.

For all of the rest of its behaviour, it seems to be a bash shell (my default shell). Entering some perl commands appeared to just be ignored, such as something like “my $i=10; print $i*5;”

But then I tried to do an ls in my home directory in the following way:

ls -al | s/p/Q

and as predicted it turned all occurrences of p to Q in the file listings. I tried to pipe ls through s/[pP]/q, but that didn’t work for me. So if I wanted to turn both upper and lowercase from p or P to Q, I would require a second pipe:

ls -al | s/p/Q | s/P/Q

This might be somewhat understandable, but I tried this on my Cygwin installation (on a native Perl interpreter, not just a shell, and s/p/Q changed both uppercase and lowercase p. [pP] is a sed/vi convention that specified a substitution upon detection of any letter inside the square brackets, in this case, p or P. I normally use that thinking as a shorthand for not needing to know all of the Perl string handling parameters. It the kind of thing that enamoured me to perl in the first place, due to its low learning curve if you already know how to use sed or the substitution commands in vi, both of which are pretty much the same as each other.

So, it looks like psh could be a good testbed for experimental commands or interesting shell scripts, but its actual usefulness is incubment in how well its output and behaviour matches up with your native perl installation.