If you want to run an SQL script via sqlplus in the shell prompt, the command is as below.
sqlplus user/pass@connect @scriptname
Don't forget that there should be an exit command at the end of the sql. Otherwise, the sqlplus will not exit and just stop running until you manually call exit.
Now, if the SQL script does not have exit at the end, you'll have to do the following.
echo exit | sqlplus user/pass@connect @scriptname
This is another trivial thing that can be easily forgotten.