Samuel Wales writes:
> hi eric,
>
> the object is to make the code inside a babel shell block as similar
> to a real shell script as possible. also, calling it using #+call
> should be like calling it from another shell script.
>
> this isn't possible in babel at present.
>
> the script cannot u
hi eric,
the object is to make the code inside a babel shell block as similar
to a real shell script as possible. also, calling it using #+call
should be like calling it from another shell script.
this isn't possible in babel at present.
the script cannot use "$@" for its positional parameters.
Samuel Wales writes:
> thanks for the examples, but they don't meet my needs as tables for
> each set of arguments would be too unwieldy.
>
How about this.
#+name: list
#+begin_src sh :var files="" :results verbatim
IFS="
"
for file in $files;do
echo "-|$file|-"
done
#+end_src
#+call: list("
thanks for the examples, but they don't meet my needs as tables for
each set of arguments would be too unwieldy.
what would be ideal is to allow setting noweb expansions in the call
line (instead of requiring named blocks to provide the expansion).
i.e. it is similar to setting a var, but is a now
Samuel Wales writes:
> hi eric,
>
> say you want to list 2 files: "1 space" and "nospace".
>
> #+call: list(how="\"1 space\" nospace")
>
> #+name: list
> #+BEGIN_SRC sh :noweb yes :results verbatim output
> {
> # this fails
> # ls $how
> # this would work, if there were a call
hi eric,
say you want to list 2 files: "1 space" and "nospace".
#+call: list(how="\"1 space\" nospace")
#+name: list
#+BEGIN_SRC sh :noweb yes :results verbatim output
{
# this fails
# ls $how
# this would work, if there were a call option to support it
# ls <>
} 2>&1
Use org-babel-expand-block (C-c C-v v) to view the code block with the
variable expansion.
Best,
Samuel Wales writes:
> i don't know why the shell does not unquote here:
>
> #+BEGIN_SRC sh :results verbatim output :var how="a 'b' \c \"d\" e"
> :var dothis="echo \"hi\""
> echo $how
>
i don't know why the shell does not unquote here:
#+BEGIN_SRC sh :results verbatim output :var how="a 'b' \c \"d\" e"
:var dothis="echo \"hi\""
echo $how
$dothis
#+END_SRC
#+RESULTS:
#+begin_example
a 'b' c "d" e
"hi"
#+end_example
thanks.
samuel
--
The Kafka Pandemic: http://thek