Difference between revisions of "read multiline user input in bash"
From thelinuxwiki
(Created page with "<source lang="bash"> # get input from user via CLI echo "Paste import config..." IFS= read -d '' -n 1 importvariable while IFS= read -d '' -n 1 -t 2 c do importvariable+=...") |
|||
(One intermediate revision by one user not shown) | |||
Line 2: | Line 2: | ||
# get input from user via CLI | # get input from user via CLI | ||
− | echo "Paste | + | echo "Paste input..." |
− | IFS= read -d '' -n 1 | + | IFS= read -d '' -n 1 inputvariable |
while IFS= read -d '' -n 1 -t 2 c | while IFS= read -d '' -n 1 -t 2 c | ||
do | do | ||
− | + | inputtvariable+=$c | |
done | done | ||
</source> | </source> |
Latest revision as of 00:39, 2 November 2022
# get input from user via CLI echo "Paste input..." IFS= read -d '' -n 1 inputvariable while IFS= read -d '' -n 1 -t 2 c do inputtvariable+=$c done