getting single quotes from newLISP through the shell

Started by cormullion, October 06, 2006, 02:37:15 AM

Previous topic - Next topic

cormullion

Not really a newLISP question, perhaps, but I'm struggling again so your help would be helpful...


(set 'r (join (map char (sequence 32 127))))
(exec (string {echo '} r {'}))

sh: -c: line 1: syntax error near unexpected token `('
sh: -c: line 1: `echo ' !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~''


I think it's that single quote, which you can't escape inside a single-quoted string, so you can't get it into a string that you can echo or pipe into a command. Is there a way?

frontera000

#1
this is ugly but :



(replace "'" r "\x27")
(exec (string {echo -e '} r {'}))

cormullion

#2
Great - thanks - it works for me (although it doesn't have elegance!). Still, that's Unix.