Quote:
Originally Posted by
curleb
One of my favorite quotes:
Best to focus on what works, since this is only impairing your need to assign aliases. If it would apply to other functionality...or if it makes itself known in other ways, we can tackle it there.
HTH
Epilogue:
Sorry...missed the part re passing args and making this alias dynamic to your session:
[Chapter 10] 10.3 C Shell Aliases with Command-Line Arguments
Thanks curleb. That link provided some very useful info for me. However, let me redefine what I am trying to accomplish.
1. Set up a c shell script named (let us say al) with the following three aliases in it:
alias s "vi $1.csv"
alias t "vi $1.txt"
alias l "vi $1.log"
2. Then run the script as al myfile.
3. This will set the 3 aliases pointing to myfile.
4. I just type s, l or t depending on which myfile.? I want to edit.
5. Then after few hours I change the file by issuing al yourfile.
6. Now all three aliases point to yourfile.? and I can use s, l or t pointing to yourfile.?.
I might do that several times in a session. I type the name of the file only once when running the script and after that I type only s, l or t depending on which file I want to edit.
If I put the alias in .cshrc file by putting \!$ in the alias definition, I still type the full filename everytime I use the alias, right ? That is what I want to avoid.
Hope that clarifies the problem.
---------- Post updated at 01:33 PM ---------- Previous update was at 01:20 PM ----------
Quote:
Originally Posted by
curleb
why not...
Here is my .cshrc.
#################################################################
#
# .cshrc file for idnadhoc domain Version 1.0 3/2004
#
#################################################################
#echo " *** starting logon script .cshrc ***"
# Set default UNIX editor to vi
setenv EDITOR vi
# Set Paths for software
set path= ( /idn/app/bin /xxxx/xxxxxxxx/bin /usr/bin /usr/ucb /usr/sbin /usr/openwin/bin /usr/dt/bin . )
setenv LD_LIBRARY_PATH ~/lib:/idn/app/lib:/lib:/usr/openwin/lib:/usr/dt/lib:/usr/lib:
setenv PGPPATH $HOME/pgp
setenv GZIP "-8v --name"
#setenv LD_LIBRARY_PATH_64=/xxxx/xxxxxxxxx/lib:$LD_LIBRARY_PATH_64
#export PATH=/xxxx/xxxxxxxxx/lib:/usr/lib:$PATH
# Host Name Set-up
switch (`hostname`)
case sppmd006:
setenv HOST "idnadhoc"
breaksw
case sppmd007:
setenv HOST "idnoae"
breaksw
default:
setenv HOST `hostname`
breaksw
endsw
if ($?prompt == 0) exit
# Set backspace key is commented out due to issues with SAS system and X commands
# stty erase ^h
# Standard UNIX options
set prompt="$HOST":"`pwd`> "
set history=999
set ignoreeof
set savehist=0
set noclobber
if ( $?prompt ) then
stty werase '^?'
stty erase '^h'
endif
echo " * starting alias section *"
# Standard Aliases
alias cd 'cd \!*;echo $cwd;set prompt="$HOST":"`pwd`> " '
alias md 'mkdir'
alias cp 'cp -i'
alias mv 'mv -i'
alias rm 'rm -i'
alias pwd 'echo $cwd'
alias del 'rm -i'
alias p 'ps -aux | more'
# User Custom Aliases
# Use alias 'ucb <command>' to get ucb version
# aliases for all shells
#junk file(s) to the trashcan:
alias can 'mv\!* ~/.trashcan'
alias cd 'cd \!*;echo $cwd;set prompt="$cwd \! " '
alias cp 'cp -ip'
alias mv 'mv -i'
alias mail 'cd /var/mail'
alias pwd 'echo $cwd'
alias cls 'clear'
alias h 'history \!* | head -39 | more'
alias clear
alias m more
#alias dir 'ls -la'
#alias dirt 'ls -lad'
alias la 'ls -a'
alias ll 'ls -la'
alias lo logout
alias bye logout
alias edit textedit
alias resize /usr/bin/X11/resize
alias land 'enscript -r -fTimes-Roman9 \!*'
alias lwf '/usr/lib/lp/postscript/postprint -p l -s 9 -l 51 \!* | lp -'
alias lpman 'troff -man \!* | /usr/lib/lp/postscript/dpost | lp'
alias ucb '/usr/ucb/\!*'
alias Ipp 'cd /intl/ipp/projects'
alias tp 'ls -lt | head -20'
alias compresstxt "compress `find . -type f -name '*.txt' -print`"
alias dir 'ls -la'
alias dirt 'ls -lad'
alias dird 'ls -al | egrep ''^d'' '
echo " *** finished logon script .cshrc ***"