OS: Ubuntu 18.04
Bash
I am trying to get one shell script to pass variables to another script and execute it. Here's what I tried:
mainscript.sh
#!/bin/bash
# Master script
SUBSCRIPT1_PATH=~/subscript1.sh
test_string="The cat ate the canary"
(exec "$SUBSCRIPT1_PATH")
subscript1.sh:
#!/bin/bash
# subscript1.sh
echo $test_string
But, when I do:
bash mainscript.sh
I get nothing. Any ideas on how to do this?