newLISP Fan Club

Forum => newLISP in the real world => Topic started by: cormullion on October 06, 2006, 02:37:15 AM

Title: getting single quotes from newLISP through the shell
Post by: cormullion on October 06, 2006, 02:37:15 AM
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?
Title:
Post by: frontera000 on October 06, 2006, 08:53:59 AM
this is ugly but :



(replace "'" r "\x27")
(exec (string {echo -e '} r {'}))
Title:
Post by: cormullion on October 06, 2006, 10:17:54 AM
Great - thanks - it works for me (although it doesn't have elegance!). Still, that's Unix.