ian@hpopd.HP.COM (Ian Watson) (04/05/89)
OK, a simple one from a neophyte... I've just entered a command 'foo bar parm', when what I wanted was 'foobar parm'. I've tried the history mechanism of the C Shell, but it seems obsessed with treating the erroneous command as a sequence of words, and so I can't seem to get the substitute to recognise 'o b', as this spans words. The few Unix folks round here are all Korn shell users. I refuse to change until I've sussed this one, as I'm too pigheaded. I'm browned off with combos of '," and \ to quote that damned space, what'm I doing wrong ? Is there any 'conceptual user model' to the mechanism that'll give me an insight into how I might tackle such stumbling blocks logically in future ? Also, why does echo `man ps` give Missing ]. as an error message ? I guess it's to do with formatting, but I read that the output within backprimes is meant to be 'straightened' Thanks in advance Ian Watson
bobg+@andrew.cmu.edu (Robert Steven Glickstein) (04/06/89)
> *Excerpts from ext.nn.comp.unix.questions: 4-Apr-89 C Shell history,* > *backprimes.. Ian Watson@hpopd.HP.COM (919)* > I've just entered a command 'foo bar parm', when what I wanted was > 'foobar parm'. I've tried the history mechanism of the C Shell, but > it seems obsessed with treating the erroneous command as a sequence > of words, and so I can't seem to get the substitute to recognise > 'o b', as this spans words. % foo bar parm foo: You're an idiot % !!:1!!:2 !$ foobar parm foobar: You're a genius % ============== Bob Glickstein ITC Database Group Information Technology Center Carnegie Mellon University Pittsburgh, PA ==============
maart@cs.vu.nl (Maarten Litmaath) (04/06/89)
ian@hpopd.HP.COM (Ian Watson) writes:
\I've just entered a command 'foo bar parm', when what I wanted was
\'foobar parm'. ...
Welcome to csh! There's no way to achieve what you want :-(
\Also, why does
\echo `man ps`
\give
\Missing ].
Compare and understand what's happening:
echo `echo [`
echo "`echo [`"
echo `echo \[`
echo "`echo \[`"
RTFM :-)
--
"If it isn't aesthetically pleasing, |Maarten Litmaath @ VU Amsterdam:
it's probably wrong." (jim@bilpin). |maart@cs.vu.nl, mcvax!botter!maart
chris@mimsy.UUCP (Chris Torek) (04/06/89)
In article <4930001@hpopd.HP.COM> ian@hpopd.HP.COM (Ian Watson) writes: >... so I can't seem to get the substitute to recognise >'o b', as this spans words. Correct. The C shell cannot substitute across words; its substition code works on individual works, not on groups thereof, nor on strings (except insofar as the words are strings). >Also, why does > >echo `man ps` > >give > >Missing ]. The manual for `ps' includes at least one unclosed `[' character (probably as part of an underline or standout ESC-[ sequence), and the C shell is trying to do file name globbing. To prevent the globbing, use set noglobl or echo "`man ps`" (the latter affects spacing as well). Neither preserves newlines (unlike sh). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris
dce@stan.UUCP (David Elliott) (04/06/89)
In article <sYCg55y00Vsn40wGNN@andrew.cmu.edu> bobg+@andrew.cmu.edu (Robert Steven Glickstein) writes: >% foo bar parm >foo: You're an idiot >% !!:1!!:2 !$ >foobar parm >foobar: You're a genius >% This broke on my csh (SunOS 4.0, but I don't think that matters). Unless I have some environment-sensitive problem, what you want is % foo bar parm foo: You're an idiot % !:0!:1 !$ foobar parm foobar: You're a genius % -- David Elliott dce@Solbourne.COM ...!{boulder,nbires,sun}!stan!dce
chris@mimsy.UUCP (Chris Torek) (04/07/89)
In article <16770@mimsy.UUCP> I typed >... To prevent the globbing, use > > set noglobl Bwhoop! Typo alert! Bwhoop! That should be `set noglob'. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris
dg@lakart.UUCP (David Goodenough) (04/10/89)
From article <2251@solo8.cs.vu.nl>, by maart@cs.vu.nl (Maarten Litmaath): > ian@hpopd.HP.COM (Ian Watson) writes: > \I've just entered a command 'foo bar parm', when what I wanted was > \'foobar parm'. ... > > Welcome to csh! There's no way to achieve what you want :-( Actually there is. --- cut here --- cut here --- cut here --- cut here --- cut here --- begin 755 redo M(R!%9&ET(&AI<W1O<GD@;&ES="!A="!L:6YE(&-O;G1A:6YI;F<@;&%S="!C M;VUM86YD("AO<&5N(&UO9&4I+@HC($=E="!U<"!T;R`R,B!M;W-T(')E8V5N M="!C;VUM86YD<RX*(R!4;R!W;W)K('!R;W!E<FQY+"!P=70@:6X@+FQO9VEN M.B`@86QI87,@<B!S;W5R8V4@+W5S<B]L;V-A;"]B:6XO<F5D;PHC($%U=&AO M<B!U;FMN;W=N+@IH:7-T;W)Y("UH(#8P(#XA("]T;7`O<F5D;RXD)`H*(R!- M86ME($-2(&UA<"!T;R`Z=W$A(&%N9"!S=&%R="!E>"!Q=6EE=&QY(&%T(#)N M9"!T;R!L87-T(&QI;F4@:6X@;W!E;B!M;V1E+@IE>"`M("<K;6%P(`T@.BYW M<2$;?"0M,2!O<&5N)R`O=&UP+W)E9&\N)"0*"G1A:6P@+3$@+W1M<"]R961O M+B0D(#XA("]T;7`O8VUD+B0D"@HC($EN<V5R="!I;G1O(&AI<W1O<GD@=VET M:&]U="!E>&5C=71I;F<N"G-O=7)C92`M:"`O=&UP+V-M9"XD)`H*(R!#;&5A M<B!O=70@=&5M<&]R87)I97,N"B]B:6XO<FT@+68@+W1M<"][8VUD+')E9&]] M+B0D"@HC($EF('1H:6YG(&-H;W-E;B!T;R!R961O(&ES('1H92!R961O(&%L M:6%S(&ET<V5L9B!T:&5N($1/3B=4(')E9&\@:70N"FEF("A`+3(Z,"`A/2!` (0#HP*2!`0`IL ` end --- cut here --- cut here --- cut here --- cut here --- cut here --- and 'alias r source redo' added to your favorite .cshrc work real nice. Now, if someone can explain why this gets all bent out of shape with aliases ...... (For the uninformed, typing 'r' puts you into redo, which allows sort of ksh like editing) -- dg@lakart.UUCP - David Goodenough +---+ IHS | +-+-+ ....... !harvard!xait!lakart!dg +-+-+ | AKA: dg%lakart.uucp@xait.xerox.com +---+
dig@peritek.UUCP (Dave Gotwisner) (04/15/89)
In article <4930001@hpopd.HP.COM>, ian@hpopd.HP.COM (Ian Watson) writes: > OK, a simple one from a neophyte... > > I've just entered a command 'foo bar parm', when what I wanted was > 'foobar parm'. I've tried the history mechanism of the C Shell, but > it seems obsessed with treating the erroneous command as a sequence > of words, and so I can't seem to get the substitute to recognise > 'o b', as this spans words. The few Unix folks round here are all Korn > shell users. I refuse to change until I've sussed this one, as I'm too > pigheaded. I'm browned off with combos of '," and \ to quote that > damned space, what'm I doing wrong ? Is there any 'conceptual user > model' to the mechanism that'll give me an insight into how I might > tackle such stumbling blocks logically in future ? Try: !:0!* This will take argv[0] and concatinate it with argv[1], adding the other arguments afterwords. In otherwords, argv[0] == foo argv[1] == bar argv[2] == parm !:0 gives the 0'th arg !* gives 1 - N !:0!* gives "foobar parm" -- ------------------------------------------------------------------------------ Dave Gotwisner UUCP: ...!unisoft!peritek!dig Peritek Corporation ...!vsi1!peritek!dig 5550 Redwood Road Oakland, CA 94619 Phone: 1-415-531-6500