2016-06-21 2 views
0

Я новичок в скрипте оболочки, и я попытался понять, почему он прекратил работу после команды, которая отправляет задание в гауссовый (вычислительная химическая программа). Вот мой код.bash script завершает работу до завершения

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$** 
+0

У вас возникли ошибки? –

+0

Я этого не сделал. В сообщении добавляется журнал терминалов. Программное обеспечение для химикатов говорит мне «нормальное завершение», что я сомневаюсь, что это прекратит мой скрипт. –

+3

В вашем скрипте отсутствуют некоторые довольно важные вещи - как линия shebang. '#!/Bin/sh'? '#!/Bin/bash'? Это '#!/Bin/sh -e' или' #!/Bin/bash -e', perchance? Подробности важны! –

ответ

0

Хорошо, так что это было какое-то время, и я думаю, что я должен закрыть этот вопрос, так как по предложению от @Charles Даффи, я добавил притон линию и очистить формат, проверяя, есть ли CR/LF проблема (Я писал сценарий в Windows). Да, это решило проблему. Спасибо, Чарльз!