I'm trying to open a new terminal window run a program and output that to a file. This is the code I'm using when i run it it opens a new terminal and runs it correctly but never pipes the output to the file.
./my-router topology.txt A | tee -a outputA.txt
If i run the above code it will run correctly and output to a file.
gnome-terminal -e "./my-router topology.txt A | tee -a outputA.txt";
If i run just the above code it will open a new terminal and run but not output. Not sure what I'm doing wrong.
#!/bin/bash
gnome-terminal -e "./my-router topology.txt A | tee -a outputA.txt";
gnome-terminal -e "./my-router topology.txt B | tee -a outputB.txt";
gnome-terminal -e "./my-router topology.txt C | tee -a outputC.txt";
gnome-terminal -e "./my-router topology.txt D | tee -a outputD.txt";
gnome-terminal -e "./my-router topology.txt E | tee -a outputE.txt";
gnome-terminal -e "./my-router topology.txt F | tee -a outputF.txt";
you need to do it like this
gnome-terminal -e 'bash -c "./my-router topology.txt 2>&1 | tee outputA.txt"
'