tcsh - questions about alias, dotfiles

Joined
Sep 28, 2007
Messages
8
Reaction score
0
Points
1
Hello,

I'm a newbie, trying to port my linux dotfiles to the factory-installed BST unix under mac OS X 10.4. I have set my default shell to tcsh and I'd really like to update my .cshrc so that it works with that. I have for example this line

alias lrrt 'ls -lrt'

When I launch a new tcsh, or source this .cshrc file manually from a tcsh prompt, and then try to issue the alias with no arguments, here's what I get;

<my_iMac_tcsh_prompt> % lrrt
:No such file or directory

I've also tried this;

alias lrrt 'ls -lrt \!*'

which has the same effect.

Note that if I execute the alias directly at the tcsh prompt, and then use it with no arguments, it works

<my_prompt> % alias lrrt 'ls -lrt'
<my_prompt> % lrrt
total 72
drwxr_xr_x 183 blah blah 6222 Sep 9 13:39 some_directory
drwxr_xr_x 5 blah blah 179 Sep 13 14:44 some_other_directory
[etc.]

Also, I am attempting to set the path;

set path=($path . /Users/me/bin /usr/bin /sw/bin /sw/igpp/bin)

When this is executed as part of a .cshrc, I get

tcsh: set: Variable name must begin with a letter.

This is encouraging as it shows at least that tcsh is the shell executing the commands, but I think the syntax of the set command is correct.

If I do a

< my_prompt > % which tcsh
/bin/tcsh

is what I see.



Any suggestions or explanations about what is going on here would be truly appreciated -

C
 
OP
N
Joined
Sep 28, 2007
Messages
8
Reaction score
0
Points
1
Some more info

So, I now believe this has something to do with the way my .cshrc file is formatted. If I run vim and type the aliases in, one by one, then I get a clean file and it sources on startup successfully. Even cutting and pasting from the old, linux-imported file into a new vim session (with a new file) seems to work. But, looking at the hidden characters using vim :)set list) the end-of-line formatting looks to be correct.

Still a mystery, but at least I have a workaround-

C
 
Joined
Apr 29, 2006
Messages
4,576
Reaction score
378
Points
83
Location
St. Somewhere
Your Mac's Specs
Mac Studio, M1 Max, 32 GB RAM, 2 TB SSD
Hi, I just set up a minimal .cshrc to test this out. Here is what I put in mine:

Code:
alias c clear
alias cls 'clear;ls'
alias ls 'ls -lrt'

Then I launch tcsh via the command 'tcsh'. I get no errors. If I then type 'alias', I get this output:

Code:
[new-host:~] mac57% alias
c       clear
cls     clear;ls
ls      ls -lrt

So, it would seem that all is well... do remember that irrespective of the shell you are using, the commands (such as ls) are the BSD flavor not the Linux flavor, so the command syntax has variations. Check man as need be.
 
Joined
Apr 29, 2006
Messages
4,576
Reaction score
378
Points
83
Location
St. Somewhere
Your Mac's Specs
Mac Studio, M1 Max, 32 GB RAM, 2 TB SSD
Great, glad to hear that things are moving ahead, and that mirrors my experience above.

It *sounds* like you have *something* in your original file that is throwing things off - rather like the opening directive:

Code:
#! /bin/sh

perhaps being pointed to the wrong place, hence there not being a valid command interpreter for it... I am stretching here, but that is what I would be looking for.
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
I believe that you want to create a file called .tcshrc. In this file you will place all the items you want to define.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top