allbery@ncoast.UUCP (Brandon Allbery) (06/12/86)
Expires: Quoted from <941@uwvax.UUCP> ["Re: Gripes about /bin/sh AND /bin/csh"], by pfeiffer@uwvax.UUCP... +--------------- | I have given up on creating "executable variables" in a form acceptable to both | rsh AND csh. This all started when I tried to prefix commands with a string | named "rsh_prefix" which would evaluate to null or "rsh hostname -l username", | depending on the environment; I had enough problems trying to quote metachars | and avoid the use of temp files that I gave up and rsh'ed everything, including | local commands. Any advice that people have on this score would also be | appreciated. +--------------- Advice: Give up. sh and csh just ain't compatible. As far as optionally running a command via rsh, early csh'es have a special alias called ``shell''. (I have no idea if 4.2BSD supports it, so this may not help). The idea was: alias ``shell'' to a simple command (no variables, alias substitutions, etc., and it has to be a full pathname) and all subsequent commands will be run as if the ``shell'' alias had been prepended to the line. I use this regularly with a program ``bexec'' which forces all shell scripts to be run by /bin/sh, interprets #! at the beginning of a file, and (last resort) attempts to execute the file as an RM/COBOL program. In your case, try: alias shell /bin/rsh hostname -l username (if /bin/rsh is the path; substitute the correct one). If you want it to be decided based on the environment, write a C program (shell scripts will NOT work!) to examine the environment and exec either the command or an rsh. Of course, if this nifty little feature was removed from the 4.2 csh, I can't help you. See if someone has 2.9BSD csh sources (if you have a source license). Anyone interested in my ``bexec'' program as described above, drop me a note. It's been heavily modified since my original version, and now works like 4.2BSD (w.r.t. #!) except that it doesn't support setuid. I could theoretically add that, but setuid shell scripts strike me as being a mistake anyway... --Brandon -- ihnp4!sun!cwruecmp!ncoast!allbery ncoast!allbery@Case.CSNET ncoast!tdi2!brandon (ncoast!tdi2!root for business) 6615 Center St. #A1-105, Mentor, OH 44060-4101 Phone: +01 216 974 9210 CIS 74106,1032 MCI MAIL BALLBERY (part-time)