I am using Centos 7 Here is my script
#!/bin/bash
echo "select option"
echo "1. test1"
echo "2. test2"
echo "3. test3"
echo "4. test4"
read option
case "$option" in
"1") echo "sourcing test1"
source ~/ansible-keys/test1-file.rc
echo "sourced Espoo 42"
;;
"2") echo "sourcing test2"
source ~/ansible-keys/test2-file.rc
;;
"3") echo "sourcing test3"
source ~/ansible-keys/option3-file.rc
;;
"4") echo "sourcing test4"
source ~/ansible-keys/option4-file.rc
break
;;
esac
I read an option from the user input values (1 to 4) and then execute the corresponding case. The .rc files basically exports a few variables using export command. But when I execute this script the source commands seems not working.
I tried to replace, source with .
. But it was not working too.
How to fix this?