Explanation reqd

Hi,
i have a script of following content

#!/usr/bin/sh
'exit 255' USR1 
ncm_CheckDir.pl -a 
/cnt/mgr/test/working/applog_CheckDir.log -c 
/cnt/mgr/test/lib/config/bp_CheckDir.conf -s 
/cnt/mgr/test/log/syslog

filename : BC_CheckDir
when i execute ie :

sh BC_CheckDir

i am getting error

BC_CheckDir[11]: ncn_CheckDir.pl: not found

this ncn_CheckDir.pl is available in the same folder where the BC_CheckDir exist .
That is in my system file
BC_CheckDir and perl file
ncm_CheckDir.pl available in /cnt/mgr/test/bin

can any one explain why this error is coming and what is happening
in the script

note : i am running this in ksh

thanks in advance
hari

can you try hardcoding the path to ncn_CheckDir.pl ( also is there a typo ncn_CheckDir.pl and ncm_CheckDir.pl ?? )

#!/usr/bin/sh
'exit 255' USR1 
./ncm_CheckDir.pl -a 
/cnt/mgr/test/working/applog_CheckDir.log -c 
/cnt/mgr/test/lib/config/bp_CheckDir.conf -s 
/cnt/mgr/test/log/syslog 

or

#!/usr/bin/sh
'exit 255' USR1 
/cnt/mgr/test/bin/ncm_CheckDir.pl -a 
/cnt/mgr/test/working/applog_CheckDir.log -c 
/cnt/mgr/test/lib/config/bp_CheckDir.conf -s 
/cnt/mgr/test/log/syslog 

Hmmm... To me it seems like the error comes from line 11; you posted your script on 6 lines.
Can't find ncn_CheckDir.pl, script says ncm_CheckDir.pl -a. Do you have a typo there, or was it when you were typing it into the post?

sorry guys

it is ncn_CheckDir.pl -a only

#!/usr/bin/sh
'exit 255' USR1  
ncn_CheckDir.pl -a 
/cnt/mgr/test/working/applog_CheckDir.log -c 
/cnt/mgr/test/lib/config/bp_CheckDir.conf -s 
/cnt/mgr/test/log/syslog

ncn_CheckDir.pl exist in the folder

but error is coming

pls help me

thanks & regards
Hari

call it with ./ as suggested by pkabali

./ncn_CheckDir.pl

and make sure ncn_CheckDir.pl is executable.

i tried both way as pkbali suggested
still not found error is coming
when i put ./ncn_CheckDir.pl it is giving me
BC_CheckDir[11]: ./ncn_CheckDir.pl: not found

when hard coded the path then also
with all path and not found is coming :frowning:

---------- Post updated at 06:02 AM ---------- Previous update was at 04:55 AM ----------

any settings to be done with .profile file ??

shot in the dark here. Maybe an issue with permissions on the .pl file? is it executable

Also as Mirni said, have you pasted the entire code ( because it seems the error is in line 11? )

Does the ncn_CheckDir.pl file have a white character in the name?
Check with:

ls -Q ncn_CheckDir.pl

or just

ls -Q

in the directory.
It will print quotes around the files.

What do you expect this line to do?

'exit 255' USR1 

That's what I was wondering too, looks like the last half of a trap statement.

I suspect the script has comments at the top that have been cut out (for privacy etc.) along with the trap.

eg green section below:

#!/usr/bin/sh
# Eight lines
# of comment
# The OP didn't
# want to post
# to this thread -
# Perhaps for
# Privacy Reasons
#
trap 'exit 255' USR1
ncn_CheckDir.pl -a
...

the full code

#!/usr/bin/sh
#
#       BC2M0010_CheckDir - Verify if transmission files exist
#
# Revisions:
#
# 11/08/01  created for second midday batch
  cd /cnt/mgr/test/bin
  trap 'exit 255' USR1
  ncn_CheckDir.pl -a 
/cnt/mgr/test/working/applog_CheckDir.log -c 
/cnt/mgr/test/lib/config/bp_CheckDir.conf -s
/cnt/mgr/test/log/syslog

all the files available in bin directory.we are doing migration.
in old server (sh-shell) it is working.
in new server (ksh shell) giving the error
ncn_CheckDir.pl -a not found.

Try invoking it with

perl ncn_CheckDir.pl -a

yes. it's working great. thanks