problem in executing a file


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users problem in executing a file
# 1  
Old 04-25-2003
problem in executing a file

All,
I've a script that I'm trying to execute with crontab. But it was not working. Then when i checked executing the script manually, I've found a strange thing. the script executes only with
sh <SCRIPTNAME> and not with ./<SCRIPTNAME>

I'm using Red hat 7.3, and the error that i'm getting is

linux /home/user11/bkp> ./<SCRIPTNAME>
bash: ./BACKUP_EXP: No such file or directory
linux /home/user11/bkp>

Can clues? I'm not getting any problem with other scripts. I'm sure it's got nothing to do with the script, as the script is not getting started. About the permissions, that's also the same.
I tried creating another script and tried executing with ./ and it worked!!
any suggestions?
# 2  
Old 04-25-2003
./scriptname will execute scriptname either with whatever shell your using, or what executable the script refers to, eg: #!/bin/bash
would be the first line in the script and tells your system to use bash to execute the rest of the script. its possible that you are missing the #!/bin/... at the top of your script, in that case try adding #!/bin/sh to have sh execute it. if there is something there make sure what it points to actually exists.
# 3  
Old 04-30-2003
If it were a problem with the #! line, I'd think there'd be some sort of error about "bad interpreter" or the like..

This may sound obvious, but make sure you typed the name of the script right.. watch the case of the letters - BACKUP_EXP is not the same as Backup_Exp

If that's not it and the scripts aren't too large, post the code of the script that's not working and then post the code of a script that is working.. or if they're huge just post the first 10 to 15 lines of each one..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

having problem while executing the script

Hi i am getting stuck while executing the script in the below line .Please help me out if ;then Name=`grep -i $Size $FILE|awk '{print $(NF-1),$NF}' |head -1` else Name="$Nam" fi (3 Replies)
Discussion started by: soumyamishra
3 Replies

2. UNIX for Dummies Questions & Answers

problem in Executing script in ksh

Hi, I am in ksh. below mentioned 3 commands I executed at command prompt & got the expected results. csh source csh_infa <special command> Now I have to do this in the script in ksh. I entered it as it is. #!/bin/ksh csh source csh_infa <special command> Now after... (1 Reply)
Discussion started by: girish_kanak
1 Replies

3. Shell Programming and Scripting

Problem in executing For loop....

Hi frnds I trying to execute the following ksh, #!/bin/ksh file=$OBS_APP_PATH/config/com/uhg/obs/inbound/configs/ServiceFeeDetail.xml inputFileDir=$OBS_APP_PATH/config/com/uhg/obs/inbound/configs/ echo $file echo $cntWrd if then echo "Inside IF" for i in 'ls -t1... (7 Replies)
Discussion started by: balesh
7 Replies

4. Programming

c executing shell problem

Hello im geting error here: #include <stdlib.h> #include <stdio.h> using namespace std; int main (int argc, char *argv) { char user; string command; cin << user; command = printf ("grep '%s' /etc/shadow", user); system (command.c_str()); } return 0; } it should search shadow... (6 Replies)
Discussion started by: velniaszs
6 Replies

5. Shell Programming and Scripting

Problem executing a script

Hi Friends, When I try to execute one of my script script1.shl, I am getting the error message as "/tmp/sh1871978.13: cannot create" . I could not find the specified sh* file in the /tmp directory and I also checked the disk space of /tmp and it is only 60% filled. Please help me on... (5 Replies)
Discussion started by: mr_manii
5 Replies

6. UNIX for Dummies Questions & Answers

Problem executing find file command in Linux

When trying to find a list of files with specific text in them using find . -type f -exec grep -l "DataStage Job 4263" {}\; I get error find: missing argument to 'exec' How can I correct this ? I'm on Linux Red Hat. Cheers PS I'm a DataStage programmer not a systems support... (4 Replies)
Discussion started by: jackdaw_at_work
4 Replies

7. Shell Programming and Scripting

Problem executing script through at

Hey fellows, i've got a probkem while executing a command through a scheduled at-job; Somehow my script starts looping, when triggered throug at; It doesnt do so if started manually. Any ideas? #!/bin/sh # atrun uid=33 gid=33 # mail www-data 0 umask 22 cd /var/django/webripper/ripper... (2 Replies)
Discussion started by: viktor4124
2 Replies

8. Shell Programming and Scripting

Problem with executing script using ssh

I'm writing a script which is meant to ssh into a remote machine, sed a file there, and write the output to a new file on the remote machine. Obviously the easy way to do this is to write and execute the script on the remote machine, but I'm trying to do this all via ssh since I like to keep and... (4 Replies)
Discussion started by: maethlin
4 Replies

9. Shell Programming and Scripting

Problem executing a script

The script startserver.sh has permissions to execute. Still the nohup command returns error with 'No such file or directory' Any sugggestions: $ nohup ./startserver.sh & Error $ nohup: appending output to `nohup.out' nohup: cannot run command `./startserver.sh': No such file or... (4 Replies)
Discussion started by: hemangjani
4 Replies

10. Shell Programming and Scripting

Problem executing nohup

I am trying to submit background jobs using the nohup command on a client system where my session is running under a "master shell" (BASH). If I try to nohup the actual job (ie: nohup MYJOB.BAT > MYJOB.LOG 2>&1 &) the command will fail with a return code of 126 and a "permission denied" message.... (0 Replies)
Discussion started by: christyw
0 Replies
Login or Register to Ask a Question