in tcsh !$ is the last argument of the last command line:
m:~> man find
m:~> echo !$
find
I'm searching a way to get the current command line (before entered)
m:~> echo $current_comm
echo
Thanks.
!#
refers to the current command. It can be indexed by appending a :
and a number.
For example:
% echo !#:0
echo echo
echo
%
(The shell prints history expansions before executing them, which is why the echo echo
line appears.)
A more elaborate example:
% echo arg1 arg2 arg3 COMMAND=!#:0 ARG1=!#:1 ARG2=!#:2 ARG3=!#:3
echo arg1 arg2 arg3 COMMAND=echo ARG1=arg1 ARG2=arg2 ARG3=arg3
arg1 arg2 arg3 COMMAND=echo ARG1=arg1 ARG2=arg2 ARG3=arg3
%
For more information, man tcsh
and search for "History substitution".