Prev: What is the difference between "su" and "sudo" ?
Next: Mozilla-browser: pops up a default plugin dialogue box
From: j on 1 Jan 2010 01:29 Under tcsh, when i run "ctest /var" through the following alias, alias ctest 'echo $1; pushd $1' The screen looks like this: > ctest /var /var ~ If I try this one: alias ctest3 'pushd $1; echo $1' >ctest3 /var pushd: No other directory. could anybody tell me why the $1 system fails in alias? If I type the above command by: echo /var; pushd /var or pushd /var; echo /var they both work.
From: J G Miller on 1 Jan 2010 12:03
On Fri, 01 Jan 2010 14:29:50 +0800, J wrote: > Under tcsh, when i run "ctest /var" through the following alias, > > alias ctest 'echo $1; pushd $1' That is not the correct syntax for alias parameters under csh/tcsh. To reference the first parameter you need alias ctest 'echo \!:1; pushd \!:1' Obviously the second parameter will be \!:2, etc, etc, and all parameters is \!:* You should review the manual page for tcsh since pushd is a built in under tcsh and has some behavior specific to tcsh, along with some special variables See especially QUOTE Directory stack substitution (+) The directory stack is a list of directories, numbered from zero, used by the pushd, popd and dirs builtin commands (q.v.). dirs can print, store in a file, restore and clear the directory stack at any time, and the savedirs and dirsfile shell variables can be set to store the directory stack automatically on logout and restore it on login. The dirstack shell variable can be examined to see the directory stack and set to put arbitrary directories into the directory stack. UNQUOTE and text which follows. |