如何读取未知的多个变量然后显示它们?

Ita*_*not 0 bash shell

我正在尝试编写看起来像这样的东西:

#!/bin/bash
echo "type your separated words"
read *all variables*
echo *all variables*
Run Code Online (Sandbox Code Playgroud)

那可能吗?

iru*_*var 5

您可以使用read将它们存储到数组中

read -p $'type your separated words:\n' -a arr
printf "%s\n" "${arr[@]}"
Run Code Online (Sandbox Code Playgroud)