I have simple command:
echo "foo=bar" | cut -d "=" -f1
to cut some string from some string.
How can I assign this result to some variable?
Nothing works:
(echo "foo=bar" | cut -d "=" -f1)
$test=`(echo "foo=bar" | cut -d "=" -f1)`
$test=`$(echo "foo=bar" | cut -d "=" -f1)`
$test="$(echo "foo=bar" | cut -d "=" -f1)"
Output:
foo
script.sh: 14: =foo: not found
script.sh: 1: foo: not found
script.sh: 15: =: not found
script.sh: 16: =foo: not found