nohup
will not work with functions. You need to create a shell script which wraps and executes the function. The shell script then you can run with nohup
Like this:
test.sh
#!/bin/bash
function hello_world {
echo "hello $1, $2"
}
# call function
hello_world "$1" "$2"
chmod +x test.sh
and then call it in your for
loop:
for i in `cat mylist`; do
nohup ./test.sh $i 'mycommand' &
done