bash脚本在完成之前退出

时间:2016-06-21 22:17:11

标签: bash unix

我是shell脚本的新手,我试图理解为什么它在将作业提交到Gaussian(计算化学程序)之后停止运行。 这是我的代码。

echo "hi, the script is running..."
location=$(dirname $1)
echo $location
g09 <<EEE 
%chk=test2
$(cat $1)
EEE
echo $?
echo "done"
echo "need help??????" >tttt.txt

它没有显示最后三个回声,而计算程序正常终止。

我的假设是当程序退出时,我的脚本也会被终止。但这可能吗?我应该如何解决它?

    **Last login: Tue Jun 21 17:56:40 on ttys001
    -bash: ulimit: open files: cannot modify limit: Invalid argument
    lab-chem067-02:~ gaussian$ /Users/gaussian/Desktop/test.sh /Users/gaussian/Desktop/cd7041a_cd7041a.gjf 
    hi, the script is running...**
    /Users/gaussian/Desktop
     Entering Gaussian System, Link 0=g09
     Initial command:
     /Applications/gaussian/g09/l1.exe "/Applications/gaussian/scratch/Gau-2788.inp" -scrdir="/Applications/gaussian/scratch/"
     Entering Link 1 = /Applications/gaussian/g09/l1.exe PID=      2790.

     Copyright (c) 1988,1990,1992,1993,1995,1998,2003,2009,2013,
                Gaussian, Inc.  All Rights Reserved.

     This is part of the Gaussian(R) 09 program.  It is based on
     the Gaussian(R) 03 system (copyright 2003, Gaussian, Inc.),
     the Gaussian(R) 98 system (copyright 1998, Gaussian, Inc.),
     the Gaussian(R) 94 system (copyright 1995, Gaussian, Inc.),
     the Gaussian 92(TM) system (copyright 1992, Gaussian, Inc.),
     the Gaussian 90(TM) system (copyright 1990, Gaussian, Inc.),
     the Gaussian 88(TM) system (copyright 1988, Gaussian, Inc.),
     the Gaussian 86(TM) system (copyright 1986, Carnegie Mellon
     University), and the Gaussian 82(TM) system (copyright 1983,
     Carnegie Mellon University). Gaussian is a federally registered
     trademark of Gaussian, Inc.

     This software contains proprietary and confidential information,
     including trade secrets, belonging to Gaussian, Inc.

     This software is provided under written license and may be
     used, copied, transmitted, or stored only in accord with that
     written license.

     The following legend is applicable only to US Government
     contracts under FAR:

                        RESTRICTED RIGHTS LEGEND

     Use, reproduction and disclosure by the US Government is
     subject to restrictions as set forth in subparagraphs (a)
     and (c) of the Commercial Computer Software - Restricted
     Rights clause in FAR 52.227-19.

     Gaussian, Inc.
     340 Quinnipiac St., Bldg. 40, Wallingford CT 06492


     ---------------------------------------------------------------
     Warning -- This program may not be used in any manner that
     competes with the business of Gaussian, Inc. or will provide
     assistance to any competitor of Gaussian, Inc.  The licensee
     of this program is prohibited from giving any competitor of
     Gaussian, Inc. access to this program.  By using this program,
     the user acknowledges that Gaussian, Inc. is engaged in the
     business of creating and licensing software in the field of
     computational chemistry and represents and warrants to the
     licensee that it is not a competitor of Gaussian, Inc. and that
     it will not use this program in any manner prohibited above.
     ---------------------------------------------------------------


     Cite this work as:
     Gaussian 09, Revision D.01,
     M. J. Frisch, G. W. Trucks, H. B. Schlegel, G. E. Scuseria, 
     M. A. Robb, J. R. Cheeseman, G. Scalmani, V. Barone, B. Mennucci, 
     G. A. Petersson, H. Nakatsuji, M. Caricato, X. Li, H. P. Hratchian, 
     A. F. Izmaylov, J. Bloino, G. Zheng, J. L. Sonnenberg, M. Hada, 
     M. Ehara, K. Toyota, R. Fukuda, J. Hasegawa, M. Ishida, T. Nakajima, 
     Y. Honda, O. Kitao, H. Nakai, T. Vreven, J. A. Montgomery, Jr., 
     J. E. Peralta, F. Ogliaro, M. Bearpark, J. J. Heyd, E. Brothers, 
     K. N. Kudin, V. N. Staroverov, T. Keith, R. Kobayashi, J. Normand, 
     K. Raghavachari, A. Rendell, J. C. Burant, S. S. Iyengar, J. Tomasi, 
     M. Cossi, N. Rega, J. M. Millam, M. Klene, J. E. Knox, J. B. Cross, 
     V. Bakken, C. Adamo, J. Jaramillo, R. Gomperts, R. E. Stratmann, 
     O. Yazyev, A. J. Austin, R. Cammi, C. Pomelli, J. W. Ochterski, 
     R. L. Martin, K. Morokuma, V. G. Zakrzewski, G. A. Voth, 
     P. Salvador, J. J. Dannenberg, S. Dapprich, A. D. Daniels, 
     O. Farkas, J. B. Foresman, J. V. Ortiz, J. Cioslowski, 
     and D. J. Fox, Gaussian, Inc., Wallingford CT, 2013.

     ******************************************
     Gaussian 09:  EM64M-G09RevD.01 24-Apr-2013
                    21-Jun-2016 
     ******************************************
     %chk=test2
     -------------------------------
     #P HF/STO-3G 6d 10f NoSymm FChk
     -------------------------------
     1/38=1/1;
     2/12=2,15=1,17=6,18=5,40=1/2;
     3/6=3,8=22,11=9,16=1,25=1,30=1/1,2,3;
     4//1;
     5/5=2,38=5/2;
     6/7=2,8=2,9=2,10=2,28=1/1;
     99/5=1,9=1/99;
  ==============omitted part, chem software output=================
     WOMEN HOLD UP HALF THE SKY. -- MAO TSE TUNG
     Job cpu time:       0 days  0 hours  0 minutes  1.5 seconds.
     File lengths (MBytes):  RWF=      7 Int=      0 D2E=      0 Chk=      1 Scr=      1
     Normal termination of Gaussian 09 at Tue Jun 21 18:05:20 2016.
    **lab-chem067-02:~ gaussian$** 

1 个答案:

答案 0 :(得分:0)

好吧,所以已经有一段时间了,我想我应该关闭这个问题,因为根据@Charles Duffy的建议,我添加了shebang line并通过检查是否有任何cr来清理格式/ lf问题(我在Windows上编写脚本)。是的,这解决了这个问题。谢谢Charles!

相关问题