What I used to do is:
Manually open a terminal instance to run the following commands and shell files
which exports and sets some variables.
source ff.sh $input $output
which asks me to enter a number during its execution.
So I had to manually copy and paste these in the terminal before every run.
What I want to do now is to put all this in script file which will automatically open the terminal and run them in sequence so that the next command only runs when the first one is finished, so that I don't have to do this manually anymore.
After applying muru's suggestion found here I used the below script just for steps 1 to 4 but it's not working properly:
gnome-terminal -x sudo -u userA bash -c 'PPACKAGE_PATH=/home/userA/package1:/home/userA/package2:$PACKAGE_PATH; cd /home/userA/scripts; source varset.sh; bash'`
It is not run in the same sequence I put it.
This successfully opens the terminal but the first line appears in the terminal is a message which is found in
varset.sh (although this should be the third command to run) and the other thing is that none of the variables that should be set using this
varset.sh is set, for example when I use echo $var1 (which is found in variables.sh) is display nothing which means the variables is not set the only thing that works in variables.sh is the echo message displayed.
The second line that appears in the the directory is the terminal working directory which is set to the
The third thing is that this command
PACKAGE_PATH=PACKAGE_PATH=/home/userA/package1:/home/userA/package2:$PACKAGE_PATH which sets the $PACKAGE_PATH variable is not working.
So if anyone could please advise how to run these commands and shell files in the requested sequence.
&&. Now each command only runs when the previous has quit without an error.