getting : No such file or directory while executing a shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting getting : No such file or directory while executing a shell script
# 1  
Old 10-10-2008
getting : No such file or directory while executing a shell script

Hi all,

I am getting : No such file or directory while executing a shell script. But i have that corresponding file in the corresponding path. It also have executable rights. Please help me out in this

Thanks in advance.
Ananthi.U
# 2  
Old 10-10-2008
Have you make your script executable with chmod?
Have you start your script with /directory/scriptname or ./scriptname?

Regards
# 3  
Old 10-10-2008
sorry i couldnt get u Smilie
# 4  
Old 10-10-2008
re: help

well i guess u created a script by using cat or the vi editor ..after that u need to change the permission of the script using chmod 777 filename ..since its a script u need to make it a executable ..after that u could run the script sh filename.sh ...or simply ./filename..both will work ..i guess this was what the previous person was trying to explain
# 5  
Old 10-10-2008
re:

and he was trying to explain that have u created the script in the correct directory? or are u giving the whole path while running the script.



PS. correct me if i am wrong . Smilie
# 6  
Old 10-10-2008
Also if you donn wan to use it like "./filename" then you need to put your script file in $HOME/bin ... if it exists and included in $PATH, or else create bin in $HOME or anywhere u like and also .. export the same to the $PATH.
eg. export PATH=$PATH:$HOME/bin
then use it as "filename".
# 7  
Old 10-10-2008
You need to copy your scripts file to $HOME/bin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script cannot create directory and move the file to that directory

I have a script, which is checking if file exists and move it to another directory if then mkdir -p ${LOCL_FILES_DIR}/cool_${Today}/monthly mv report_manual_alloc_rpt_A_I_ASSIGNMENT.${Today}*.csv ${LOCL_FILES_DIR}/cool_${Today}/monthly ... (9 Replies)
Discussion started by: digioleg54
9 Replies

2. Shell Programming and Scripting

Compiling and Executing a Java File With a Shell Script

I'm trying to use a shell script to compile and execute a java file. The java classes are using sockets, so there is a client.java file and a server.java file, each with their own shell script. I also want to handle the command line arguments within the shell script, not the java classes. The... (1 Reply)
Discussion started by: britty4
1 Replies

3. Shell Programming and Scripting

What is the function of the following lines at the top of a shell script file: Directory and Script?

The file starts like this: Directory: <path to the script> Script: <script fife name> #!bin/ksh ##Comments <actual script> What is the use of the first two lines in the script? What if I save the file without them? What will be the effect? They are not comments. Im very new to this,... (4 Replies)
Discussion started by: remytom
4 Replies

4. Shell Programming and Scripting

Shell scripting-I need a script which should watch a directory for a file with specific directory

I need a script which should watch a directory for a file with specific directory. If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column. The file should be moved to another directory and the a... (8 Replies)
Discussion started by: akashdeepak
8 Replies

5. Shell Programming and Scripting

Creating a Continuous File Reading-Executing Shell Script

I need to write something that will read and execute all the files(Mainly executable scripts) inside one or more folders; in other words, a continuous chain with a break when finished. I'm new to shell and need syntax help. I'm on Ubuntu 12.10-Gnome btw. Here are some main highlights I think... (2 Replies)
Discussion started by: linuxlololol
2 Replies

6. Homework & Coursework Questions

Shell Script - (file and directory)

The question is here: http://farm9.staticflickr.com/8065/8217767191_2154e64904_b.jpg My problem is that when I made up a non-existing directory, it prints out "hiii". It didn't enter the first if statement. It works if my directory exist. My Work: for fileOrDirectory in $* # all... (1 Reply)
Discussion started by: spider-man
1 Replies

7. Shell Programming and Scripting

How can I get the directory of my executing script?

hi, I tried whence $0, but that just gives me the filename relative to where I am executing the script from. I need to get the full pathname. thanks (19 Replies)
Discussion started by: JamesByars
19 Replies

8. Shell Programming and Scripting

Executing Multiple .SQL Files from Single Shell Script file

Hi, Please help me out. I have around 700 sql files to execute in a defined order, how can i do it from shell script (3 Replies)
Discussion started by: anushilrai
3 Replies

9. Shell Programming and Scripting

Executing script's directory

I have a shell script /home/user1/bin/sh1, how can I print out the directory of this file inside the script. Say I am in /home/user1/, then I run /home/user1/bin/sh1 I need it to print out /home/user1/bin. Thanks. (2 Replies)
Discussion started by: jasony001
2 Replies

10. Shell Programming and Scripting

Reading file names from a file and executing the relative file from shell script

Hi How can i dynamically read files names from a list file and execute them from a single shell script. Please help its urgent Thanks in Advance (4 Replies)
Discussion started by: anushilrai
4 Replies
Login or Register to Ask a Question