← Back to team overview

sslug-teknik team mailing list archive

Funktionskald i bash

 

Hvad er der galt her:

#! /bin/bash

for n in 1 2 3; do
    loop($n)
done

#function loop(x) {
loop(x) {
    echo "looping: $x";
}


./functiontest.sh 
./functiontest.sh: syntax error near unexpected token `loop($n)'
./functiontest.sh: ./functiontest.sh: line 4: `    loop($n)'


Det er ligemeget om jeg har 'function' med eller ej.
Føler mig noget dum, har ikke før brugt funktionskald i shellscripts.
-- 
Regards,
           Mr Dev - Mogens Valentin
    http://www.mrdev.com - mrdev@xxxxxxxxx
OpenSource Security - Networking - Programming


Follow ups