TipsAndTrickstcsh effectively. When enough meat is generated here, than we may go ahead and refactor this page.
Urgent: We need some full form of TIP -- Tcsh In Practise, or Tcsh Is P?? etc.
Urgent: Webmaster .. which Wiki is this .. how to get monospaced font ?
e.g. I want a 'cd' without argument to behave as cd - instead of cd ~. So i do following:
'alias cd 'source ~$USER/.tcsh/func_cd'where the script ~$USER/.tcsh/func_cd is
if ( "X$1" == "X" ) then cd - else cd $1 endif
It's easy to make a default tcsh install even better and (some say) more user friendly.
Visit http://tcshrc.sourceforge.net/ and download their package. You'll be quite surprised at the features it adds to your tcsh install.
launch a bash or Bourne shell one-liner:
/bin/sh -c "${ME}: USAGE foo [bar|baz] quux >&2"
on some systems you can do:
echo my error message > /dev/stderr
or:
echo error > /dev/fd/2
put in your .tcshrc:
if( $?REMOTEHOST && ! $?DISPLAY ) then
setenv DISPLAY ${REMOTEHOST}:0
endif
I'm often asked how to find a pattern in certain types of files within a directory tree. For example, how does one find all occurrences of a variable in C source code without finding them in the SCCS history files? Here's an alias to do it:
alias cgrep 'find . -regex ".*/SCCS" -prune -o -name "*.[ch]" -type f -exec grep \!* {} /dev/null \;'
Then, you can simply use it as:
cgrep [GREP_OPTIONS] PATTERNNote that this requires a "find" command which supports the "regex" option, such as GNU find. By changing the strings following the "regex" and "name" options, you can modify this to search for various types of files while excluding other types of directories.
I often see Bash users complain that Tcsh does not give a list of completions with the tab key. This is not true. Not only can Tcsh list complentions, but it can do it in color. Just add this to your ~/.tcshrc
set autolist set color set colorcat
I also like to set this option...
set nobeep