Sending user input to the embedded code

If we want to send user-entered keyboard data directly to embedded code, then we should use the embedded language input-related command:

    $ ksh -c "read INPUT; echo "You_typed_'$INPUT'"" 
  

This would allow the code to accept input from users. It waits for a user to type and hit Enter. After pressing Enter, this line would prints You_typed_Hello there.

Get Learning Linux Shell Scripting - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.