Search code examples
bashfunctionjobs

Bash jobs on function


I'm trying to jobs an ldap research in a for loop to to more than 1 by 1 searching. In my loop, i'm using a function which i'm sending some parameter to search. I'm trying a lot of things but my script still not create any job so his still taking a lot of time in execution. It is possible to job a function in a bash script?

search () { 
    user=$(ldapsearch something $1)
    if [[ -n $user]] 
        echo "KO" 
    fi 
} 
for line in file.csv; 
do 
    search $line
done

Solution

  • I found my solution by using a big ldapsearch and parsing the result behind with grep and sed then using for loop to increment my counter and display the error which not maching with the if