I have a very simple shell script 'ex1.sh' goes as follows,
#!bin/bash
xspec
data a.pi
'xspec' will open a new prompt xspec, and waits the following commands, say, here is 'data a.pi'. The regarding details is not that important. My question is that when I source this shell script, 'data a.pi' will not be executed.
I think I get what the problem is: after executing 'xspec', the terminal open xspec prompt, which is also shown in the Figure. However, this command 'xspec' does not return any thing to the main terminal, so the following command 'data a.pi' will not be run.
Since not all people use xspec, you may run the following shell script to reproduce this problem:
#!bin/bash
python
print("Hello world!")
If you source this shell script, the terminal will not execute 'print("Hello world!")'.
I know that I can create a hello.py file, and use 'python hello.py' to fix this problem.
But I just wonder: can I do this by just writing a single shell script and just sourcing this shell script?
I expect to do all the work in one single shell script. For data reduction in astronomy, we usually need to change between different prompts.