I have a shell script for which the following things need to be done: 1) To store the shell script in the log file the wanted. 2) Shell script will have to signal the user and read the input with a message.
Example:
cat read-test.sh echo -n "What is your name?" Read User_name this script Implemented:
./read-test.sh> & Gt; Read-test.log Expected User Prompt:
What is your name? Rajeeee When I send this script to
. / Read-test.sh
I output as I
But when I send this script to
. / Read-test.sh & gt; & Gt; Read-test.sh
"What is your name?" Is saved in the test.log file which I do not want.
Is there a way where I can show the user with a message ("What is your name?") And reads the input?
The best answer depends on how you want to redirect in the way, but A possible quick solution would have to change your echo line like this: echo -n "What is your name?" & Gt; / Dev / tty
Comments
Post a Comment