Read in txt file and run a different command for each line

hi,

i'm trying to write a tcsh script that reads in a text file (one column) and the runs a different command for each line of text.

i've found lots of example commands for bash, but not for tcsh.

can anyone give me a hint?

thanks,
jill

1 Like

tcsh hmmm stands for "turbo" C-SHELL ? ...
Was used a lot in the early years of SunOS, at the time FORTRAN, assembler and C was used intensively... as was mostly used by C language programmers as offered more than the basic Bourne shell only times have changed Korn has evolved a lot and with GNU stuff and linux arriving and widespread so did the usage of bash...
Why would one use tcsh currently unless he is a C aficionado?
All I can suggest then is to look back in older literature like manuals of SunOS4 or anything early 90' where it was commonly used - I remember of a good documentation maybe around 93 I used then with linux v.a99p118 ... Dont remember if it were part of that slackware release.
Good luck, what is wrong with bash or ksh? Is it you are using an old BSD?

If I understand you right, you are looking for a tutorial which teaches you tcsh programming. There won't be much around, since the number of tcsh programmers is, as I have the impression, very small. Even RosetteCode (Category:Programming Languages - Rosetta Code ), which hosts many obscure languages, has no entry for tcsh! You can try

A basic tutorial on the tcsh shell

but in any case also read Csh Programming Considered Harmful . While this targets csh, many of the points discussed in this text also apply to tcsh.

rather than a basic tutorial, i'm hoping someone can tell me how to gain this one functionality in my script.

why use tcsh? my guess is because the software package i'm running is basically a collection of C programs and most of the scripting from the developers uses tcsh. the developers ecommend using tcsh with their software. they program more and more in python now, but a lot of the programs in teh collection are in C.

non-sequitor. tcsh has no special features related to using C programs. "C-shell" is nothing but buzzwording, the same way javascript isn't java.

How old is this program?

i only mentioned C because the previous poster mentioned that tcsh was used a lot by c programmers. i'm no expert in these matters.

as to when it was written, it started in the mid nineties, and development is ongoing.

You could do a case statement in tcsh like this, but its not recommended.

I don't see what C has to do with tcsh, but maybe you mean that there is already a bunch of tcsh scripts, and want to extend the functionality, so you want to stick with tcsh.

I personally would even in this case write new features in Zsh or bash or some other suitable language (Ruby, Python, Perl), but of course this is everyone's personal taste. If you really want to continue with tcsh, I fear there is not much alternative, and you will have to spend a day or so going through the tutorial and at least part of the man-page.

If you really need help here, you need to ask a concrete question. The way you asked, is to broad. With which tcsh statement do you have a problem? You could for instance post a statement in bash and ask how to express something similar in tcsh.

Still then, it's not sure that you will get much response, because tcsh is so rarely used. Maybe there are some dedicated tcsh forums around?

Hi.

See also Unix Shells: Bash, Fish, Ksh, Tcsh, Zsh - Hyperpolyglot

Best wishes ... cheers, drl