11_userinput.sh (542B)
1 #!/bin/sh 2 3 # We can go on ahead and read user input easily 4 # 5 # $ echo "Enter your name below" 6 # $ read user_input 7 # $ echo "$user_input" 8 # 9 # Unfortunately echo will take the user input into a new line. To avoid 10 # that you can use printf (like in C) or, less posix compliant, use 11 # 'echo -n' to avoid that new line 12 # 13 # $ printf "Enter your name: " # equivalent as the next line 14 # $ echo -n "Enter your name: " 15 # 16 # Fix this program that is meant to input the user's input into a file 17 18 printf "Enter your sentence: " 19 read user_input > 11_file