Hi
I essentially just want to do the following with my bash script:
read.sh
Code:
#!/bin/bash
echo "Insert Number"
read num
echo $num
Now this works fine on its own when run as
Sometimes however I want to have the option to be able to output it into a file from the command line if I would like so I tried running it as
Code:
read.sh > output.txt
This results in the echo being put into the output file instead of prompting the user. How do I go about this while maintaining the option of making an output in the command line if I would like?
Thanks