1

I was wondering how to redirect the output from my bash file (which is getting its input from another redirect) to a txt file.

This is how I run my program:

$ ./myFile.bash < input.txt

I would like to save my output to some txt file (something like this):

$  out.txt < ( myFile.bash < input.txt )

What would be the most correct/formal/generic ways to go about this? Are there multiple options if any?

LinFelix
  • 1,026
  • 1
  • 13
  • 23
User_x
  • 21
  • 3
  • You might want to look into the syntax of `>`, `>>` and `|`. Those should be explained in any basic tutorial such as https://learnxinyminutes.com/docs/bash/ But in short, `>` takes the output of a command and write it into a file. But be careful, that overrides the current of the file. `>>` appends the output to a file. – LinFelix Nov 17 '20 at 00:04

1 Answers1

1
$ ./myFile.bash < input.txt > out.txt
eduffy
  • 39,140
  • 13
  • 95
  • 92