Ubuntu 18.04
I have one shell script: doit.sh that copies a shell script to another user's home folder, and then tries to run it. I tried multiple combinations, but it's not working.
doit.sh:
#!/usr/bin/env bash
sudo mv testsh.sh /home/test3
sudo chown test3:test3 /home/test3/testsh.sh
sudo -i -u test3 bash << EOF
testsh='testsh.sh'
exec $testsh
EOF
testsh.sh:
#!/bin/bash
echo "export RAILS_ENV='rails_env'" | tee test3.4 >/dev/null
testsh.sh was moved to /home/test3, but the test3.4 file was not created in /home/test3 and I am not getting any error messages. Any idea if this can be done?