So I want to assign a variable in bash that takes piped code from head.
first2chars=$[[ echo $1 | head -c 2 ]]
but when I want to use this I get an error of:
[ echo -n2 | head -c 2 ]: syntax error: operand expected (error token is "[ echo -n2 | head -c 2 ]")
Figured it out:
first2chars=$(echo $1 | head -c 2)
the above code works