Snippet IT IT News, Programming, Internet and Blogging

16Aug/100

Unix Shell Script: How to Receive Input Right After Echoing A Line

ADVERTISEMENTS

For example, say I echo a line of text in shell script and I want to receive user input just right after the text (not in the next line). The are several ways to do it:

Method 1

echo "Enter a value: \c"
read value

Method 2

echo -n "Enter a value: "
read value

Method 3

read -p "Enter a value: " value

Most Commented Posts

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


*

No trackbacks yet.