I have the following code that results in a "Permission denied" error. It is supposed to get the nth word of a string and store it to a variable. If I use it with echo, it works just fine, but produces the error when trying to save it to a variable.
a="one two three four five six"
N=2
b=$($a | awk -v N=$N '{print $N}')
echo $b
What could the problem be?