[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Shell Scripts



On 4/24/05, Art Edwards <edwardsa@icantbelieveimdoingthis.com> wrote:
> I've also written the script so that it doesn't need my set of aliases.
> However, it simply does not ls the same way as tcsh or csh.
> I can run bash scripts from within tcsh by placing
> 
> #!/bin/bash
> 
> at the top of the script. Why doesn't the same thing seem to work for
> tcsh within tcsh?

You can see if you're actually in tcsh (which you probably are) by
adding the following line to your script:
/bin/ps -p $$

How is the behavior of ls differing?  If it's not reading your
aliases, see if you've got something like:
if ($?prompt) then
...
endif
around your alias definitions.  It's also possible that ls has some
options which only work in certain environments, such as an
interactive shell or a shell connected to a suitably smart stdout
device like xterm.  As someone else pointed out, if you're setting
aliases in .login, then your script won't set them (unless you specify
"/bin/tcsh -l").

-- 
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh
http://mamarsh.blogspot.com



Reply to: