From mboxrd@z Thu Jan 1 00:00:00 1970 From: dexen deVries To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Wed, 28 Aug 2013 14:13:49 +0200 Message-ID: <12528660.BEdGTc6QD4@coil> User-Agent: KMail/4.10.5 (Linux/3.11.0-rc3-l52; KDE/4.10.5; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Subject: Re: [9fans] acme: send dot to the stdin of a more complicated command Topicbox-Message-UUID: 7563663a-ead8-11e9-9d60-3106f5b1d025 On Wednesday 28 of August 2013 10:05:14 Rudolf Sykora wrote: > Hello, >=20 > I tried to modify Russ' script below to be usable on p9p. I came up w= ith > ------------------------------------ > #!/usr/local/plan9/bin/rc >=20 > if(! ~ $#* 1) { > echo 'usage: Run title' >[1=3D2] > exit 1 > } >=20 > id=3D`{awk -v 'pat=3D'$1 '$6 ~ pat {print $1}' <{9p read acme/index}}= > if(~ $#id 0) { > echo 'no match for pattern' >[1=3D2] > exit 2 > } > if(! ~ $#id 1) { > echo 'ambiguous pattern' >[1=3D2] > exit 3 > } > if(~ `{wc -w <{9p read acme/$id/rdsel}} 0) { > echo 'no command selected' >[1=3D2] > exit 4 > } > #exec cat <{9p read acme/$id/rdsel} > exec /usr/local/plan9/bin/rc <{9p read acme/$id/rdsel} > ------------------------------------ >=20 > but the last line doesn't really do what I want, yielding the error: > Run: exit 1 > rc: /dev/fd/5:2: token EOF: syntax error your selection lacks the final LF to make Rc happy ;-) a quick and dirty hack would be to always append LF: exec /usr/local/plan9/bin/rc <{9p read acme/$id/rdsel;echo;} tested with: echo foo bar rc <{9p read acme/$winid/rdsel; echo; } selecting bare `echo foo bar' (without LF) gives syntax error; selectin= g whole=20 line works a-OK --=20 dexen deVries [[[=E2=86=93][=E2=86=92]]] Take care of the luxuries and the necessities will take care of themsel= ves. -- L. Long