Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!accuvax.nwu.edu!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: help with csh alias Message-ID: <16873@mimsy.UUCP> Date: 12 Apr 89 04:51:24 GMT References: <8077@boulder.Colorado.EDU> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 33 In article <8077@boulder.Colorado.EDU> cdash@boulder.Colorado.EDU (Charles Shub) writes: >desired version > mycommand `expr - 5` other args This is easy in sh, harder in csh; in csh it must be done in two steps. What you want is echo $1 | sed s/:// spliced in for ; the natural way to express this would be expr `echo $1 | sed s/://` - 5 and so the natural way to express the whole thing would be mycommand `expr \`echo $1 | sed s/://\` - 5` morestuff This works properly in sh, but not csh. So we have to resort to shell variables: set tmp=`echo $1 | sed s/://`; mycommand `expr $tmp - 5` morestuff or two levels of alias: alias part1 'expr `echo $1 | sed s/://` - 5' mycommand `part1` morestuff or anything equivalent to this, as long as it does it `one splice at a time'. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris