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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.