I'm getting an error trying to write the output of a command into a variable, which is defined in a function.
chk()
hostsum=$(md5sum /etc/hosts | awk -F" " '{print $1}')
chk
It tells me about a syntax error:
./testchk.sh: Zeile 3: Syntaxfehler beim unerwarteten Wort
hostsum=$(md5sum /etc/hosts | awk -F" " '{print $1}')' ./testchk.sh: Zeile 3:hostsum=$(md5sum /etc/hosts | awk -F" " '{print $1}')'
It works outer the function, but just won't because of the function adding some extra quotes. Any ideas except using it out of the function?