Question : Writing a bash script to write output to a file

I am writing a script to run a tool then write the output to a file.

The script would consist of running the following command:

monitor-edid --vbe-port 1

The user would specify what the port number is on the command line.  
Then the file it would be saved to would be something like:
filename.txt
Could someone give me some sample code?  Thanks!

Answer : Writing a bash script to write output to a file

1:
2:
3:
4:
5:
6:
7:
8:
#!/bin/bash
if [ $# -ne 1 ]
then
   echo "Usage: $0 [port num]"
   exit 1
fi
 
monitor-edid -vbe-port $1 >filename$1.txt 2>&1
Open in New Window Select All
Random Solutions  
 
programming4us programming4us