Reputation: 1628
I have a script that asks my users for some input. name, id, location etc
Is it possible for them to paste multiple lines of data into a prompt input and have that saved to a file ?
echo -e "Please enter the details:"
read data
# Do something... and save to file..
They will be pasting data similar to :
67jhub7uy86b8tib8,North
485734957934fsdfs,East
7676bh7h87g87bibi,East
89798kfhg8r9t8494,South
98onoulj5005555tr,West
There could be one line, there might be 50 lines..
Any ideas ?
Upvotes: 2
Views: 2056
Reputation: 785856
You can use this read
:
read -rp 'Please enter the details: ' -d $'\04' data
and press ctrl-D
on terminal after entering your multiline data.
Check content of data
variable by using
declare -p data
Upvotes: 4