I'm trying to set a variable in bash:
b=$(p | cut -d',' -f4)
echo $b
However, I keep ending up with:
p: command not found
I've tried every combination of brackets, curly brackets, and dollar signs but still can't get b to equal $p | cut -d',' -f4. To my understanding, the dollar signs will extract the value from the variable and the brackets are for expression containment. Is there fundamental bash syntax that I'm not aware of?
p? and what exactly are you even trying to do?pisn't a command, so why try and run it in a subshell like one? I think you'll want anechoin front of it, for example:b=$(echo "$p" | ... )...b=$(echo "$p" | cut -d',' -f4)