On Wednesday 28 of August 2013 10:05:14 Rudolf Sykora wrote:
> Hello,
> 
> I tried to modify Russ' script below to be usable on p9p. I came up with
> ------------------------------------
> #!/usr/local/plan9/bin/rc
> 
> if(! ~ $#* 1) {
>         echo 'usage: Run title' >[1=2]
>         exit 1
> }
> 
> id=`{awk -v 'pat='$1 '$6 ~ pat {print $1}' <{9p read acme/index}}
> if(~ $#id 0) {
>         echo 'no match for pattern' >[1=2]
>         exit 2
> }
> if(! ~ $#id 1) {
>         echo 'ambiguous pattern' >[1=2]
>         exit 3
> }
> if(~ `{wc -w <{9p read acme/$id/rdsel}} 0) {
>         echo 'no command selected' >[1=2]
>         exit 4
> }
> #exec cat <{9p read acme/$id/rdsel}
> exec /usr/local/plan9/bin/rc <{9p read acme/$id/rdsel}
> ------------------------------------
> 
> 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; selecting whole 
line works a-OK


-- 
dexen deVries

[[[↓][→]]]

Take care of the luxuries and the necessities will take care of themselves.
                -- L. Long


Reply via email to