How to pass arguments in custom command link url?

On my openwrt router I have

  • created a shell script requiring 2 input parameters
  • created a custom command that calls this script and enabled Public Access

When I use the link that is specified in the Dashboard tab for Custom Commands then this is working fine except that I do not know how I can pass my 2 input parameters in the url.

So how should I extend the display result URL with extra parameters ?

Append the arguments separated with slash to the URL, e.g. https://router/cgi-bin/luci/command/cfg12345678/arg1/arg2

1 Like

This works for one argument, but not for 2 arguments.

So it correctly sets jan as first argument of the script for the following URL:

but when specifying the following URL:

Note that specifying the 2 arguments jan enable in the Custom Commands Dashboard works as expected:

Ah,yes the commands module tokenizes the arguments itself, so instead of .../arg1/arg2 it should be .../arg1%20arg2 (basically url-encode the entire space separated argument list).

3 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.