Reputation: 9054
I'm trying to create a shell script that sets an environment variable and then calls another shell script which gets that environment variable. The following code is my attempt, but it's not producing the desired result...
scriptOne.sh
export MYVAR=blob
bash ./scriptTwo.sh
scriptTwo.sh
#!/bin/bash
# SIMPLE
printenv MYVAR <<END
ls || pwd && ls
ls || ls | wc || pwd && ls
END
echo
Upvotes: 1
Views: 123
Reputation: 4551
Try $MYVAR
in scriptTwo.sh you need to add a dollar to expand a shell variable. I think you can call it using simply $ bash scriptTwo.sh
btw.
Upvotes: 2