tricky syntax for passing arguments in csh aliases
I want to write a little time-saving alias for my .cshrc file that will move files and then cd to the directory I've moved them to. What I can't quite figure out is the syntax to say 'move all the arguments except the last one.' Here is what I have:
alias follow 'mv \!:1-$-1 \!:$; cd \!:$'
This actually seems to work, but it also gives me an irritating error:
mv: cannot stat `destinationdirectory/-1': No such file or directory
Similarly, I tried:
alias follow 'mv \!:*$#argv-1 \!:$; cd \!:$'
Again the move and cd are successful, but again there is an error:
mv: cannot stat `destinationdirectory/0-1': No such file or directory
I can guess that the problem is in getting the alias command to parse my expression the way I would like it to, but I can't figure out quite what will make it happy. Please let me know if you have any ideas.