Sample Header Ad - 728x90

How to read the user input line by line until Ctrl+D and include the line where Ctrl+D was typed

9 votes
4 answers
22596 views
This script takes the user input line after line, and executes myfunction on every line #!/bin/bash SENTENCE="" while read word do myfunction $word" done echo $SENTENCE To stop the input, the user has to press [ENTER] and then Ctrl+D. How can I rebuild my script to end only with Ctrl+D and process the line where Ctrl+D was pressed.
Asked by user123456 (5258 rep)
Oct 13, 2016, 06:58 PM
Last activity: Apr 11, 2025, 05:29 AM