QuantumPackage / qp2

Quantum Package : a programming environment for wave function methods
https://quantumpackage.github.io/qp2/
GNU Affero General Public License v3.0
72 stars 31 forks source link

Test case script #214

Closed abigcoder04 closed 2 years ago

abigcoder04 commented 2 years ago

|> [root@host-10-208-55-132 qp2]# vi test.sh |> [root@host-10-208-55-132 qp2]# bash test.sh test.sh: line 4: qp: command not found test.sh: line 5: qp: command not found test.sh: line 6: qp: command not found |> [root@host-10-208-55-132 qp2]# qp qp - Shell function of the qpsh shell

Why can I execute the qp statement directly on the command line, but if I put the qp statement inside the script and let the script execute it, it will show that the qp operation cannot be found

scemama commented 2 years ago

qp is a shell command introduced in your current shell when you source /path/to/qp2/quantum_package.rc. When you run test.sh, you execute a new bash to run your script, and the qp function is not inherited in this new shell. You should add source /path/to/qp2/quantum_package.rc to your test script for it to know the qp command, or you can execute your script in the same shell: source script.sh