Skip to contentSkip to conversation

missing arguments for script functions

DISCUSSION Olaf Hering 2 participants 3 messages Mar 31, 2016 – Apr 6, 2016

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 3 lines · Olaf Hering

Is this supposed to work?

function f() {

This gives syntax error to me. But

function f {
echo $1
}

works.

Quoted 18 lines

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
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#2 lore raw
Quoted 5 lines · Andrei Borzenkov
Quoted 3 lines · Olaf Hering

Is this supposed to work?

function f() {

Quoted 7 lines

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