eftychia: Me in poufy shirt, kilt, and Darth Vader mask, playing a bouzouki (vader)
Add MemoryShare This Entry
posted by [personal profile] eftychia at 10:19am on 2011-03-22

I seem to be on a sort-of daylight waking schedule again, at least for now. But with a nap in the middle.


So I'm working on this system that involves C, sed, a shell script, ImageMagick, Ghostscript, abcm2ps, and HTML.

I've written the shell script in csh/tcsh because when I first got my fingers on a Xenix shell prompt decades ago, csh looked more interesting than sh and I picked that to learn ... and I've never been sufficiently motivated to really master sh even though that's what all the shell script examples are always in (well, bash these days, but hey, whatever), along with pretty much every part-of-the-OS-distro script I've looked at and most other scripts anyone has written to share with others.

So here's the question:

Once I get this thing polished and debugged, should I

  • Grit my teeth, dump the bash man page to Mom's printer, and finally get around to teaching myself bash,
  • Ask a bilingual friend to translate my tcsh script into bash for me,
  • Leave it as is; that's what "#!/bin/tcsh" on the first line is for,
  • Learn Perl like a modern person,
  • Uh, I mean Python, or
  • Wrap it up in the C program with system() calls and just have one monster executable?

(And yeah, I know some of my friends prefer ksh, zsh, and others, but when it comes to distributing software in shell-script form, I seldom see anything other than sh/bash, and except for briefly using ksh under MKS + Desqview/X, all I've ever used is csh/tcsh.)

My gut instinct is to leave it in tcsh, 'cause that'll make it easier to maintain, and think about maybe someday getting around to adding an installer script (uh, I mean an 'install' target in the Makefile I should get around to writing) that looks up the correct local path to tcsh and modifies the magic-cookie first line of the script. I just wonder, am I that unusual for writing scripts in tcsh? OT1H, as I said, I only ever see sh/bash scripts distributed; OTOH, there must have been enough csh users to make developing tcsh worth somebody's time.

There are 3 comments on this entry. (Reply.)
 
posted by (anonymous) at 03:21pm on 2011-03-22
(from jmax315)
In descending preference
1. Grit teeth, learn bash. (don't particularly like myself, but it's *so* ubiquitous)
2. Wrap it up in the C program.
3. Learn Python (or Ruby).
4. Leave it as is and require tcsh

I suggest avoiding Perl, unless driven to it by circumstances (for example, my personal mail sorter is still in Perl, because the various CPAN Mail::* packages are still the best canned libraries for parsing email that I'm aware of). It's a nasty language, full of edge and special cases, with the additional handicap that, as far as I can infer, Larry Wall hates to actually explain anything, he prefers to just spew examples.

Python is a decent language, and rapidly approaching the universality of Perl. Ruby is a nicer language, IMO, but isn't as universal, and lacks as comprehensive a set of libraries.
 
posted by [identity profile] unix-vicky.livejournal.com at 06:10pm on 2011-03-22
csh (and its improved subling tcsh) seem to be present on most BSD/Linux machines these days, though they may not be the default for new users. So, any reason to avoid it?

Learning sh/ksh/bash syntax is probably worthwhile, but learning Python may be even more worthwhile (we use it at work in order to have cross-platform (Linux/Windows) scripts). I haven't used Ruby, but I agree with jmax that Python is way better than Perl.
 
posted by [identity profile] austin-dern.livejournal.com at 10:45pm on 2011-03-22

My instinct would be to leave it as it is unless you wanted to pick up bash, Perl, or Python for other reasons and saw this as a way to bully yourself into learning those. After all, the important thing is, when it comes time to patch this next, will you understand its workings well enough to modify it?

(I use tcsh myself, but that's mostly because I learned how to turn on the equivalent of spell check for tcsh's commands on Mac Terminal and now I can't do without that.)

Links

January

SunMonTueWedThuFriSat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24
 
25
 
26
 
27
 
28
 
29
 
30
 
31