I was wondering if there is any way to redirect created files from a .sh script to a specific directory without modifying the script itself but straight from command line.
I've a script prove.sh that creates some file in the current directory:
#! /bin/bash echo "try 1" > try.1.txt echo "try 2" > try.2.txt
and I would like to redirect those created files not in the current directory but in another directory (let's say ~/Documents/prove/) straight from my:
sh prove.sh <...something to redirect files to directory...>
without modifying the script itself.
Do you think is it possible?
Anyone has got a clue?
EDITED: More specifically, what I need to do is to redirect the output of a program that runs on a server and that creates various file (not stdout nothing) in a specified directory in the --out field, to another computer directly (without writing anything in the original server where the program runs).
I've only host access to this server so I can not install or sudo anything. Listening a port in the second server and redirect the output to this port in nectat did not work due to firewall in the server where the program runs that I cannot change.