I am trying to run multiple process simultaneously with this:
#!/usr/bin/env bash
read -r -p "Enter number of sessions: " pro_count
read -r -p "directory of files: " d
nodeb_job() {
printf 'Connecting to %s\n' "$i"
cd || exit
if [ ! -d "$d" ]; then
mkdir "$d"/log
fi
foo "$i" "$d"/"$i" > "$d"/log/"$i"
printf 'Done with %s\n' "$i"
}
j=0
for i in $(ls "$d"); do
if (( j++ >= pro_count )); then
wait -n
fi
nodeb_job &
done
wait
It is not working, because I have an older version of Bash:
user@dacc2:~$ bash --version
GNU bash, version 3.2.57(1)-release (i386-pc-solaris2.10)
Copyright (C) 2007 Free Software Foundation, Inc.
I am a user on Solaris 10, without GNU parallel. Is there a way I can do this while still being able to specify the number of sessions from the prompt?