All of lore.kernel.org
 help / color / mirror / Atom feed
* missing arguments for script functions
@ 2016-03-31  8:28 Olaf Hering
  2016-03-31 13:49 ` Andrei Borzenkov
  0 siblings, 1 reply; 3+ messages in thread
From: Olaf Hering @ 2016-03-31  8:28 UTC (permalink / raw)
  To: grub-devel

Is this supposed to work?

function f() {
  set x="$1"
  set y="$2"

  echo "${x} ${y}"
}

f "a" "b"
f "c" "d"

In my testing the positional arguments are not provided to f().
At least when the code above is loaded via 'configfile "${var}"'.

Olaf


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: missing arguments for script functions
  2016-03-31  8:28 missing arguments for script functions Olaf Hering
@ 2016-03-31 13:49 ` Andrei Borzenkov
  2016-04-06  7:45   ` Olaf Hering
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Borzenkov @ 2016-03-31 13:49 UTC (permalink / raw)
  To: The development of GNU GRUB

On Thu, Mar 31, 2016 at 11:28 AM, Olaf Hering <olaf@aepfle.de> wrote:
> Is this supposed to work?
>
> function f() {

This gives syntax error to me. But

function f {
echo $1
}

works.

>   set x="$1"
>   set y="$2"
>
>   echo "${x} ${y}"
> }
>
> f "a" "b"
> f "c" "d"
>
> In my testing the positional arguments are not provided to f().
> At least when the code above is loaded via 'configfile "${var}"'.
>
> Olaf
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: missing arguments for script functions
  2016-03-31 13:49 ` Andrei Borzenkov
@ 2016-04-06  7:45   ` Olaf Hering
  0 siblings, 0 replies; 3+ messages in thread
From: Olaf Hering @ 2016-04-06  7:45 UTC (permalink / raw)
  To: The development of GNU GRUB

On Thu, Mar 31, Andrei Borzenkov wrote:

> On Thu, Mar 31, 2016 at 11:28 AM, Olaf Hering <olaf@aepfle.de> wrote:
> > Is this supposed to work?
> >
> > function f() {
> 
> This gives syntax error to me. But
> 
> function f {
> echo $1
> }
> 
> works.

It does. Not sure what exactly was used in my first attempt which caused
the errors. At least now it is working as expected.

Olaf


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-06  7:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-31  8:28 missing arguments for script functions Olaf Hering
2016-03-31 13:49 ` Andrei Borzenkov
2016-04-06  7:45   ` Olaf Hering

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.