Sample Header Ad - 728x90

Cannot write to file in linux environment

1 vote
1 answer
1137 views
I am using GCP Linux virtual machine and trying to execute a file and write the results into a new file. The code looks like this: ./segment.sh inputfile.txt > outputfile.txt However when I do this I get the message that permission denied for outputfile.txt I also tried sudo sh -c ./segment.sh inputfile.txt > outputfile.txt But got the same message permission denied for outputfile.txt How can I write the results to outputfile.txt? Do I need to create an empty file outputfile.txt before executing the above?
Asked by halo09876 (111 rep)
Sep 27, 2022, 08:51 PM
Last activity: Sep 27, 2022, 09:37 PM