Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

TheUsualAlex

cygwin - tcsh

Hi,

Does anyone here know how to get tcsh to launch by default with all the shell functionality in tact? When I set the tcsh to be the default launch in the cygwin.bat file, I can't even do things like "ls" and such. Only when I launch bash by default first and invoke the tcsh shell -- then that'd work.

I guess I just like to launch tcsh by default first on the fly instead of typing tcsh and 2 exits afterwards...

Thanks.

Alex

Share this post


Link to post
Share on other sites

Here's how I setup a unix environment on Windows.

1. Download cygwin from http://www.cygwin.com I can't remember what packages I downloaded but the default ones should be good. Install it to c:/cygwin

2. Create the c:/bin directory. Copy the csh.exe from your latest Houdini distribution and put it into c:/bin.

3. Now set up a HOME environment variable to point to your home directory (eg. c:/home).

4. Inside $HOME, create a .login file. In the first lines, do something like this:

setenv PATH '.;'$HOME'/bin;c:/bin;c:/cygwin/bin;'$PATH

On my home system, I use the Windows version of vim and gvim (download from http://www.vim.org) which I

install to c:/Vim. Which means my .login has:

setenv PATH '.;'$HOME'/bin;c:/Vim/vim61;c:/bin;c:/cygwin/bin;'$PATH
setenv EDITOR vim.exe
setenv VISUAL gvim.exe

5. Copy a shortcut from c:/bin/csh.exe to your desktop (and/or quicklaunch bar). Right-click on the new shortcut and choose Properties... In the Target name add the -l option after csh.exe. This tells csh.exe to source your .login file when it starts.

6. To launch, click on shortcut.

After this, you can further modify your .login file. A good start is to launch this csh and then do "printrc >> .login" which gives you a nice starting point. I generally comment out the lines "set correct=all" and "set autocorrect" as I find those features annoying. I dislike having my aliases stored in my .login file so I extracted those lines at the end out and put it into a separate file and use "source ~/.alias" instead.

Here's what I currently have in my ~/.alias file at home:

alias	ls  ls-F 
alias	l  ls-F 
alias	ll  ls-F -l
alias  h  history
alias  rm  rm -i
alias  rd	rmdir
alias  md	mkdir
alias  mv	mv -i
alias   cp 	 cp -i
alias	pwd 'echo $cwd'
alias   env printenv
alias   unsave unset savehist savedirs

alias	ali 'gvim ~/.alias; source ~/.alias'

Share this post


Link to post
Share on other sites

Hi Edward, Thanks so much for your info. Unfortunately, I am still unable to do it. I guess that's quite all right. I can just get by when what I have now.

Cheers,

Alex

Share this post


Link to post
Share on other sites

Hi Edward,

Well, in the cygwin.bat file, I specify it to launch tcsh by default (rem-ed the line on bash). tcsh launched just fine. But, default command such as ls, grep, pwd, etc. will not work. It's just a command not found. The strange thing is that it's fine if I launch bash shell first, and lauch tcsh from within bash shell. Not sure how to fix this, but I guess I'll just deal with bash-tcsh instead.

Thanks, Edward.

Alex

Share this post


Link to post
Share on other sites

That's because your path is not set up correctly. Notice how in my instructions I said to install cygwin into c:/cygwin which then my in .login script, I add c:/cygwin/bin to the PATH environment variable.

Share this post


Link to post
Share on other sites

Hi Edward, I finally got it to work last night. What I didn't do in the past was that I forgot to specify "tcsh -l" in the cygwin.bat file, hence the ls stuff wouldn't even work. Now everything worked. I guess emulation still has no match for the real UNIX environment still. But, I am happy. :)

Thanks, Edward!

Share this post


Link to post
Share on other sites

I use tcsh as well and everything works fine for me. I don't even really remember how I set things up, it's been a while. I did back-up all the configuration files, but I don't remember what I changed originally.

To think of it: The Cygwin toolset is one of the few things that makes Windows still, quite, worthwhile. I wonder if Microsoft realizes this, amidst all the 'new' and 'modern' (read: useless) features for each and - more hardware-demanding - release of Windows...

Share this post


Link to post
Share on other sites

hey guys,

gonna revive the thread from 2005 a little ;)

i set up everything like edward described, and it works fine so far, but i'm having a problem with external editors.. i'm trying to use crimson editor(some windows editor) which apparently doesn't understand the unixy path houdini sends from the .tmp.str file it creates.

everything works fine with gvim but crimson complains about an invalid path which looks something like 'C:\bin\C:\Users\Aearon\AppData\Local\Temp\hfsblabla.tmp.str' while in gvim it shows up correctly as '~\AppData\Local\Temp\hfsblabla.tmp.str' and opens the file just fine

where the C:\bin at the start of the path is wherever y run houdini from in the shell

is there maybe some way to change the string houdini sends to the editor or anything i can change in my shell setup?

Share this post


Link to post
Share on other sites

and another beginner question:

running csh.exe like this, how do you get key bindings as with cygwin? e.g. for the arrow keys (char back, char forward, up-history)

things like bindkey <ctrl-v>HOME beginning-of-line on the shell don't seem to have any effect? same for anything i tried in .login

Share this post


Link to post
Share on other sites

Here's the .loginbindkeys file that I source from .login

#Bind keys for tcsh

# Set vi bindings for keys
#bindkey -v

bindkey -b ^W backward-delete-word
bindkey -b ^U backward-kill-line
bindkey -b ^R complete-word-fwd
bindkey -b M-g list-glob
bindkey -b M-* expand-glob
bindkey -b M-v expand-variables
bindkey -b M-w normalize-command
bindkey -b M-/ which-command

bindkey -b N-up up-history
bindkey -b N-down down-history
bindkey -b N-right forward-char
bindkey -b N-left backward-char
bindkey -b N-del delete-char
bindkey -b N-ins overwrite-mode
bindkey -b N-1 which-command
bindkey -b N-2 expand-history
bindkey -b N-3 complete-word-raw
bindkey -b N-home beginning-of-line
bindkey -b N-end end-of-line

Share this post


Link to post
Share on other sites

PS. bindkey does work. Note though that since it's sourced from .login, you have to run "csh -l" when starting the shell to have it read.

Share this post


Link to post
Share on other sites

hey edward, so your second reply just now. actually i didn't know about the -b flag so that was what went wrong. thanks!

Share this post


Link to post
Share on other sites

I'm afraid I'm having some trouble getting my keybindings to work. When I run them from the command line, they work fine, but when I put them in one of my dot files, they don't work. Here's what I've got in a file I created (called .tcshkeybindings) that I source from my .tcshrc file:

echo "Running .tcshkeybindings"

bindkey "^[[b" "history-search-forward"

bindkey "^[[A" "history-search-backward"

This allows me to auto-complete a command by typing a few characters, then hitting the up-arrow - an extremely convenient feature of the tcsh shell. I've tried adding a line in there like you suggested

bindkey -b N-up up-history

but then I get the following error:

Bad key spec N-up

Any ideas how to fix this? Thanks a lot!

Here's the .loginbindkeys file that I source from .login

#Bind keys for tcsh

# Set vi bindings for keys
#bindkey -v

bindkey -b ^W backward-delete-word
bindkey -b ^U backward-kill-line
bindkey -b ^R complete-word-fwd
bindkey -b M-g list-glob
bindkey -b M-* expand-glob
bindkey -b M-v expand-variables
bindkey -b M-w normalize-command
bindkey -b M-/ which-command

bindkey -b N-up up-history
bindkey -b N-down down-history
bindkey -b N-right forward-char
bindkey -b N-left backward-char
bindkey -b N-del delete-char
bindkey -b N-ins overwrite-mode
bindkey -b N-1 which-command
bindkey -b N-2 expand-history
bindkey -b N-3 complete-word-raw
bindkey -b N-home beginning-of-line
bindkey -b N-end end-of-line

Share this post


Link to post
Share on other sites

Not sure. Personally, I've switched over to bash for a while now. You might want to ask on the tcsh.org mailing list.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now