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)
thomas@utah-gr.UUCP (Spencer W. Thomas) (06/13/86)
In article <1220@ncoast.UUCP> allbery@ncoast.UUCP (Brandon Allbery) writes: >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. >+--------------- >Advice: Give up. sh and csh just ain't compatible. You missed. Since when does rsh use sh? It has always used csh for me. The problem that pfeiffer was complaining about has to do with quoting variable expansions so that they occur properly whether the command is being run remotely or locally. You have to supply an extra level of quoting for remote commands (to deal with remote file expansion &c). This is especially nasty if you have `!'s in your string somewhere. -- =Spencer ({ihnp4,decvax}!utah-cs!thomas, thomas@utah-cs.ARPA)
chris@umcp-cs.UUCP (06/16/86)
In article <1741@utah-gr.UUCP> thomas@utah-gr.UUCP (Spencer W. Thomas) writes: >You missed. Since when does rsh use sh? I am afraid that you missed too, Spence. It uses `sh' if the remote user's login shell is `sh'. Rare perhaps, but by no means unheard-of. >The problem that pfeiffer was complaining about has to do with >quoting variable expansions so that they occur properly whether the >command is being run remotely or locally. This is probably true. >You have to supply an extra level of quoting for remote commands >(to deal with remote file expansion &c). This is especially nasty >if you have `!'s in your string somewhere. The quoting is not too terribly hard to do. Perhaps there should be a utility called `quote' that quotes its arguments against shell expansion :-). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu