The export setting environment variable in shell does not take effect?

there are two steps to start OVS on ovs"s official website, as follows:

$ export PATH=$PATH:/usr/local/share/openvswitch/scripts
$ ovs-ctl start

there is no problem with executing these two sentences separately in the terminal, but when I want to put them in a .sh file as a startup script, the shell script cannot be executed. The
script contains these two lines of code, and the error is that the command ovs-ctl cannot be found. In other words, the sentence export does not work.
what is the reason for this?

Mar.18,2021

source the environment variable file, such as source .profile. It will take effect.
Oh, I think it will be soon. What you set with export is a temporary environment variable.

Menu