Not knowing what to do with my psh

Hits: 31

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.

Remarks on LaTeX editors

Hits: 58

Nearly three years ago on another blog, I wrote about a comparison of LaTeX editors. Soon after, I began to use a third editor which, if you are a latex expert, you almost certaintly would have heard about, and are probably in fact using TeXStudio, an editor that has been around for close to a decade, but never appeared to show up on Linux installation packages. The editors that showed up, at least for me, were LyX and TeXmacs.

TeXstudio, once I discovered it, I installed it everywhere I could: on my Windows 10 and 7 machines, on my Linux installations, and even on Cygwin, even though they already had a Windows installation. To this day I have not seen any difference in output or functionality. All invocations of TeXstudio require a lot of time and packages for an installation of enough features.

This is TeXstudio, with the horizontal toolbars shown, along with part of the workspace. There are two vertical toolbars there, also partially shown.

First thing’s first: the editor. In LyX and TeXmacs, I needed to bail out of the editor, and export the code to LaTeX whenever I needed to do any serious equation editing or table editing or the like. In contrast, TeXstudio leaves me with no reason to ever leave the editor. First of all, the editor allows for native latex code to be entered. If there are pieces of Latex code that you don’t know, or have a fuzzy knowledge about, there is probably an icon or menu item that covers it. For document formatting, a menu item leads to a form dialog where you can fill in the form with sensible information pertaining to your particular document, default font size, paper size, margins, and so on. The ouput of this dialog is the preamble section to the LaTeX source file. To the rest of that source file, you add your document and formatting codes.¬† It is a kind of “notepad” for LaTeX, with syntax highlighting and shortcut buttons, menus and dialogs. It comes close to being WYSIWYG, in that “compiling” the code and pressing¬† the green “play” button brings up a window with the output of the existing code you are editing. It is not a live update, but it saves you the agony of saving, going on the command line compiling the code, and viewing in seeminly endless cycles. Now you can view the formatted document at the press of the play button.