您可以使用以下字符串来提供命令:
$ awk '{print $2}' <<< "hello world - how are you?" world $ awk '{print $1}' <<< "hello how are you > she is fine" hello she
您还可以while使用here字符串输入循环:
$ while IFS=" " read -r word1 word2 rest > do > echo "$word1" > done <<< "hello how are you - i am fine" hello