I'm currently working on creating 2 bashes with two different scripts which result in two files named with the same timestamp for easy comparison/processing later. The date variable gets created in the first sh and I try to create an environment for it to get passed onto the second sh so that it can us the same timestamp. I'm using timeout because the second script is a looping process which inputs data to the file continuously until it is killed.
1.sh
current_date_time="`date +%Y-%m-%d-%H:%M:%S`"
code
OUTPUT=$current_date_time --ouput-format csv
(export current_date_time; sudo timeout 15 2.sh)
2.sh
echo "The variable is $current_date_time"
call loop
code
OUTPUT=$current_date_time.txt
loop
The first script functions normally while the second one only results in the phrase The variable is while the output file fails to get made. My suspicion is on timeout but any ideas would be appreciated.
sudo -E timeout 15 2.sh?