Difference between revisions of "read multiline user input in bash"

From thelinuxwiki
Jump to: navigation, search
(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+=...")
 
Line 2: Line 2:
  
 
# get input from user via CLI
 
# get input from user via CLI
echo "Paste import config..."
+
echo "Paste input..."
 
IFS= read -d '' -n 1 importvariable
 
IFS= read -d '' -n 1 importvariable
 
while IFS= read -d '' -n 1 -t 2 c
 
while IFS= read -d '' -n 1 -t 2 c

Revision as of 00:38, 2 November 2022

# get input from user via CLI
echo "Paste input..."
IFS= read -d '' -n 1 importvariable
while IFS= read -d '' -n 1 -t 2 c
do
    importvariable+=$c
done