On Wed, Oct 30, 2013 at 8:09 AM, Joshua Mendelsohn <mendels...@gmail.com>wrote:

> Hi,
>
> I've been trying to use bash for quick and dirty custom tools but have not
> had any luck. I can't understand why this is not working, unless the
> quoting is messing up the expansion of %s and %d. Here is the command I
> write in custom tools:
>
> bash -c 'for i in %d/*.JPG; do echo "{{./$i?width=700}}" >> %s; done'
>
> It is intended to place all the images in the attachment folder into the
> main document. Alas, no luck. I run the custom tool from zim, it updates
> the index, but the page is unchanged. Replacing %s by %f does not work. Is
> there any way to use bash scripts as custom tools in zim?
>

Probably the substitution of "%d" and "%f" doesn't work here because they
are only replaced when they appear as single arguments. (You can check what
is actually executed by running "zim -D".)

My guess is that the easiest way to get it to work is to save the script to
a file, using positional arguments in the command ($1 and $2 instead of %d
and %s). Then call the script from the custom command as "bash myscript.sh
%d %s".

Hope this helps,

Jaap
_______________________________________________
Mailing list: https://launchpad.net/~zim-wiki
Post to     : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp

Reply via email to