[comp.unix.questions] How to execute !$var under csh?

js@lri.lri.fr (Jose Lopes De Siqueira) (10/10/90)

	If I set a variable var with a command number, I would like to be able
to execute it as !$var. However, the ! command interpretes $ as the last
command string rather than what I expected it to do. How to overcome this
problem?
	Thanks in advance,

	Jose'.
-- 
---
	Jose' de Siqueira  ( js@lri.lri.fr )
						Plus jamais,
						le temps de toujours...

gt0178a@prism.gatech.EDU (Jim Burns) (10/11/90)

in article <2234@lri.lri.fr>, js@lri.lri.fr (Jose Lopes De Siqueira) says:


> 	If I set a variable var with a command number, I would like to be able
> to execute it as !$var. However, the ! command interpretes $ as the last
> command string rather than what I expected it to do. How to overcome this
> problem?

How about:

eval \!$var

Beware tho', that when I tried it, if the selected command was an alias
that itself sets a variable, (like an alias for 'cd' that sets the
prompt), you may not get what you want.
-- 
BURNS,JIM
Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a
Internet: gt0178a@prism.gatech.edu