Skip to main content
edited tags
Link
Gilles 'SO- stop being evil'
  • 865.3k
  • 205
  • 1.8k
  • 2.3k
Source Link
ibse
  • 371
  • 1
  • 4
  • 10

Redirect stdout from a runing script

In C, you can redirect stdout somewhere when a program is running, for example:

int fd = open("some_file", O_RDWR);
dup2(fd, STDOUT_FILENO);
printf("write to some_file\n");

Can I achieve this in bash without redirecting stdout when running a bash script (./script.sh > some_file)?