LoveUnix » 其他UNIX & Linux » shell脚本无法正常运行,请高手指教!!
让LU留住您的每

一天 让LU博客留住您的每一天
2006-7-26 09:29 cqupt_me
shell脚本无法正常运行,请高手指教!!

所有的脚本都不能正常执行(如./test.sh,test.sh &),除非加sh test.sh可以正常执行,不晓得是什么原因,麻烦高手告知原因,谢谢了先!
cqsq2-/tmp> pwd
/tmp
cqsq2-/tmp> more test.sh
#!/bin/bash
ls -ltr /opt >>/tmp/test_out
cqsq2-/tmp> [color=Red]test.sh[/color]
19353
cqsq2-/tmp> more test_out
test_out: No such file or directory
cqsq2-/tmp> [color=Red]test.sh &[/color][1] 3000
cqsq2-/tmp> 19431

[1]    Done                 test.sh
cqsq2-/tmp> !more
more test_out
test_out: No such file or directory
cqsq2-/tmp> [color=Red]sh test.sh[/color]
cqsq2-/tmp> more test_out
total 1142844
drwxr-xr-x  12 informix informix     512 Jun 11  2003 info73sdk
drwxrwxrwx   5 npmdal   other        512 Mar  6  2004 dc_perl
drwxrwxrwx   7 oracle   oracle       512 Dec 28  2004 oracle.client
drwx------   2 root     root        8192 Jan 18  2005 lost+found
drwxr-xr-x   5 root     sys          512 Apr  7  2005 SUNWrtvc
drwxrwxr-x   3 bin      bin          512 Apr  7  2005 SUNWits
drwxr-xr-x  10 root     other        512 Apr  7  2005 SUNWexplo
drwxr-xr-x   6 root     sys          512 Apr  7  2005 SUNWebnfs
drwxr-xr-x   5 root     sys          512 Apr  7  2005 SUNWconn
drwxr-xr-x   2 bin      bin          512 Apr  7  2005 SUNWaman
drwxr-xr-x   4 root     root         512 Apr  7  2005 answerbooks
drwxr-xr-x   5 root     bin          512 Apr  7  2005 SUNWvts
drwxr-xr-x   2 nrmuser  wnms         512 Apr 11  2005 tars
-rw-r--r--   1 root     other    131839488 Apr 11  2005 sybase.client.tar
-rw-r--r--   1 root     other    29168128 Apr 11  2005 oracleclient.tar
drwxr-xr-x  13 root     other       1024 Apr 11  2005 ODBC
drwxr-xr-x   3 root     other        512 Apr 13  2005 ldap-setup
drwxr-xr-x  18 root     other        512 Apr 13  2005 ldap
drwxr-xr-x   6 root     other        512 Apr 20  2005 setup_col
drwxr-xr-x  12 sybase   sybase      1024 Apr 20  2005 sybase.client
-rw-r--r--   1 root     other    296219648 May 24  2005 info73sdk.col.tar
-rw-r--r--   1 root     other    123782213 May 24  2005 info73sdk.tar.Z
drwxr-xr-x   2 informix informix     512 May 31  2005 informix
drwxrwxrwx   2 nrmuser  wnms         512 Feb  8 11:47 backup
-rw-r--r--   1 npmdal   daladmin  665600 Mar  8 15:59 XML-Parser-2.34.tar
drwxr-xr-x   7 501      staff        512 Mar  8 16:00 XML-Parser-2.34
drwxr-xr-x   2 root     other        512 Jun 14 11:56 TT_DB
cqsq2-/tmp>

2006-7-26 10:16 cqupt_me
已经查明原因,.cshrc中的path的当前路径(.)放在最前面就OK了

2006-8-4 09:22 zdygk
你的脚本不要叫做test.sh也没事。:D

页: [1]


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.