I have two file call a_file and b_file. I was trying to write the a_file, so that it can change a variable in b_file.
echo "This is a_file"
echo "Enter x to display msg1 or y to display msg2"
read input
and
echo "This is b_file"
if [ "$var1" = "x" ]; then
echo "message 1"
else
echo "message 2"
fi
Can you please tell me how can I manipulate the variable var1 from the a_file?
This is a update on khachik's answer. it was pretty clear. But what If I want to make that b_file run every minute after the first execution of a_file? (crontab) Should I write it as following.
echo "This is a_file"
echo "Enter x to display msg1 or y to display msg2"
read x
* * * * * ./b_file "$x"
and
echo "This is b_file"
if [ "$1" = "x" ]; then
echo "message 1"
else
echo "message 2"
fi