Path: utzoo!attcan!uunet!uvm-gen!hartley From: hartley@uvm-gen.UUCP (Stephen J. Hartley) Newsgroups: comp.sources.d Subject: Re: v03i020: "redo" Keywords: csh history editing Message-ID: <853@uvm-gen.UUCP> Date: 20 May 88 17:15:58 GMT References: <8805171730.AA22099@cope> Organization: CSEE, EMBA, University of Vermont Lines: 35 From article <8805171730.AA22099@cope>, by goldman@cope.ucsf.edu (Eric S. Goldman): < comp.sources.misc: Volume 3, Issue 20 < Submitted-By: "Eric S. Goldman" < Archive-Name: redo < < -----------------CLEAR-TEXT VERSION----DO *NOT* CUT AND USE-------------------- < # Edit history list at line containing last command (open mode). < # Get up to 22 most recent commands. < # To work properly, put in .login: alias r source /usr/local/bin/redo < # Author unknown. < history -h 22 >! /tmp/redo.$$ < < # Make CR map to :wq! and start ex quietly at 2nd to last line in open mode. < ex - '+map ^M :.wq\!^[|$-1 open' /tmp/redo.$$ < tail -1 /tmp/redo.$$ >! /tmp/cmd.$$ < < # Insert into history without executing. < source -h /tmp/cmd.$$ < < # Clear out temporaries. < /bin/rm -f /tmp/{cmd,redo}.$$ < < # If thing chosen to redo is the redo alias itself then DON'T redo it. < if (!-2:0 != !!:0) !! < I tried this and noticed that commands "redone" this way do not go through csh aliasing, i.e. if you have "mv" aliased to "mv -i" and then "redo" some previous command that had a "mv" in it, then you will have a plain "mv" redone and run the risk of clobbering a file. Does anybody know why the aliasing check is bypassed? -- Stephen J. Hartley, Dept Comp Sci Elec Eng, Univ Vermont, Burlington, VT 05405 CSNET: hartley@uvm.EDU (802) 656-3330, 862-5323 USENET: ...!uunet!uvm-gen!hartley, {decvax,ihnp4,linus}!dartvax!uvm-gen!hartley