我想將sbcl作爲單個參數傳遞給一個bashcript,但sbcl將字符串分割成一個列表。如何將sbcl作爲單個參數傳遞給一個字符串
bashscript
#!/bin/bash
sbcl --noinform --eval "(progn (FORMAT t \"~{~a~%~}\" sb-ext:*posix-argv*)(eval (read-from-string (second sb-ext:*posix-argv*))))" $1
執行:
>sh bashsrcipt.bs "\"(FORMAT t \"YEAH\")\""
sbcl
"(FORMAT
t
"YEAH")"
debugger invoked on a END-OF-FILE in thread
#<THREAD "initial thread" RUNNING {1002999833}>:
end of file on #<SB-IMPL::STRING-INPUT-STREAM {100443F523}>
但結果應該是
>sh bashcript.bs "\"(FORMAT t \"YEAH~%\"\")"
sbcl
"(FORMAT t \"YEAH\")"
YEAH
的manual沒有提到這樣的行爲。