> > > > > > Just thought it might be useful to someone. If there's a better > > > solution out there, please tell me! > > > > Looks to me like a job for a sed + xargs one-liner(*) to me... > > > > (*) left as an exercise for the reader ;-) > > > OK, I got curious as to how easy this would be, so here's my attempt: > (split over multiple lines for clarity(!), but it could all be on > one...) > > > enlightenment_remote -binding-key-list | grep -v '<-' | \ > tr = " " | cut -d" " -f4,6,8,10,12,14 | \ > while read context key mod anymod action params; do \ > if [[ -n "`echo $mod | grep ALT`" ]]; then \ > enlightenment_remote -binding-key-del \ > $context $key $mod $anymod $action $params; \ > enlightenment_remote -binding-key-add \ > $context $key `echo $mod | sed 's/ALT/WIN/g'` \ > $anymod $action $params; \ > fi; \ > done > > > Admittedly, this doesn't use xargs after all. The (trimmed) > enlightenment_remote output contains VAR=VALUE pairs, which is already > in the right format for setting bash variables. So I wanted to pipe it > to xargs and get it to set temporary shell variables, then execute the > enlightenment remote commands using those variables. But I couldn't > figure out how to get xargs to set shell variables based on the text > it receives from the pipe. Instead, I munged the output with the tr > and cut commands, then piped it to the while loop and the read > command, etc. > > Anyone know if there's a way to do what I want using xargs? Or indeed > any way to shorten it? > > But I do like the fact that an entire object-oriented, > relational-database-driven, automatic, systematic, hydromatic, > all-singing, all-dancing, fully web 3.0 hype-infused ruby program can > be replaced by one line of (incomprehensible) bash ;-)
You're getting ruby confused with rails :-) I used Ruby here in place of Perl, since I don't like the idea of running about 5 programs in backquotes and pipes when 1 will do. Please explain to me the merits of starting about 5 programs when you can just use one to interpret a single file? Using "The Best Syntax Ever"? :-) What would be really nice is if enlightenment_remote would read in a list of commands from a text file (e.g.): binding-key-add ALL F1 NONE FALSE XXX WAZZA binding-mouse-add BORDER BOBOBOBO STUFFIT XXX etc etc Since e_remote reads in values in this format anyway, I think I may just write another ruby script. What is difficult is parsing the values returned by the -get-* methods. Perhaps there should be a flag in e_remote to output values in the same format the -set-* commands expect the arguments? Hmm.... I feel a patch coming up. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-users
