Originally from: IF grep finds what it is looking fore do X else Y but the original question was answered.
$@ has the value of "Load firefox/3.6.12"
var1=$(echo "$@" | grep -Eio '\s\w*') # Gets the application name and put it into var1
echo $var1 # is not printed should be "firefox"
var2=$(echo "$@" | grep -o '[^/]*$') # Gets version name and put it into var2
echo $var2 # prints fine
The regex is fine, it has worked before one time before i changed some thing
Edit: There is something wrong with
var1=$(echo "$@" | grep -Eio '\s\w*') #expected result is: firefox
I works fine if i use
var1="firefox"
I must have changed something a some point.
Edit: SOLUTION
echo "Load firefox/6.12.3" | awk ‘{print $2}’ | cut -f1 -d”/”
Grep is no longer used.