In my script I use
winccoaID=$(ps -aux | grep -v 'color=auto' | grep -i 'WCCOAui -console' | tr -s ' ' | cut -d ' ' -f 2)
winccLogID=$(ps -aux | grep -v 'color=auto' | grep -i 'WCCOAtoolLogView' | tr -s ' ' | cut -d ' ' -f 2)
each line looks for a certain process and assigns the pid to the value.
On cli the command works as expected. BUT in the script the commands grab another random value and adds it with a space between the 2 values. I have checked the numbers against the process list. The numbers do not relate to other process. So there is no bogus grep spoiling my fun.
Can someone tell me what is going on?