'Is a directory' error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting 'Is a directory' error
# 1  
Old 04-27-2010
'Is a directory' error

Greetings,

I'm trying to throw a script together that will search for filenames located in a text file.

Code:
#!/bin/bash

f=/home/ruhltodd/Desktop/test.txt;
exec<$f;
while read line
do
x=find /home/ruhltodd/Desktop/12345/ -name $line;
echo $x;
done


My outcome is this:
Code:
[ruhltodd@localhost Desktop]$ ./testscript.sh
./testscript.sh: line 7: /home/ruhltodd/Desktop/12345/: is a directory

./testscript.sh: line 7: /home/ruhltodd/Desktop/12345/: is a directory

./testscript.sh: line 7: /home/ruhltodd/Desktop/12345/: is a directory


If I run my find by itself I get:
Code:
[ruhltodd@localhost Desktop]$ find /home/ruhltodd/Desktop/12345/ -name test1.txt
/home/ruhltodd/Desktop/12345/test1.txt


If anyone could shed some light on why I'm receiving this error, it would be greatly appreciated! Thanks again!
# 2  
Old 04-28-2010
Your are trying to execute a directory.

See the below output:

Code:
% bash -x test.sh
+ f=/home/ruhltodd/Desktop/test.txt
+ exec
+ read line
+ x=find
+ /home/ruhltodd/Desktop/12345/ -name test
test.sh: line 7: /home/ruhltodd/Desktop/12345/: is a directory
+ echo



Try instead:

Code:
x=`find /home/ruhltodd/Desktop/12345/ -name $line`

# 3  
Old 04-28-2010
Thank you! That was it!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

No such file or directory error

I am new to shell scripting so I assume there is something basic I am missing but I have not been able to figure it out. When I run the following code from a script it can't find the paths to the directory or files. I can literally cut and paste the commands into terminal and they work fine. Why... (2 Replies)
Discussion started by: TryAgain12
2 Replies

2. Shell Programming and Scripting

Leaving directory Error

Hi, i have a question, when I install any software it give error message like as follow : sudo make password for csm: make all-recursive make: Entering directory `/home/csm/Desktop/miRanda-3.3a' Making all in man make: Entering directory `/home/csm/Desktop/miRanda-3.3a/man' make:... (18 Replies)
Discussion started by: harpreetmanku04
18 Replies

3. Shell Programming and Scripting

Change directory error

bash ~/match.sh runs fine. #!/bin/bash printf "Enter ID : "; read id printf "What panel: "; read panel cd 'C:\Users\cmccabe\Desktop\annovar' && break && break OMR=Output_Mutation_Report perl -aF/\\t/ -lne... (13 Replies)
Discussion started by: cmccabe
13 Replies

4. Web Development

Directory index forbidden by Options directive error on specific directory with indexing disabled

I am seeing the following error appear numerous times in my Apache error log: I have my Apache config configured as below, so I would expect indexing not to occur on this directory as it falls under the parent /web directory. Strangely all the IP address, including this example, all... (5 Replies)
Discussion started by: crmpicco
5 Replies

5. Shell Programming and Scripting

No Such File or Directory error

Hi! I just recently started messing around with Unix, but I've come upon one problem multiple times. Whenever I try to run a shell script, for example; #! /bin/bash #-------------------------------------- # example1 #-------------------------------------- echo "Hello, World!" I... (5 Replies)
Discussion started by: SoapilyProne
5 Replies

6. Shell Programming and Scripting

No such file or directory error

Hi, After executing load_data.sh script , it completes the steps in script but give following error.Please let me know how to fix it. ./load_data.sh: ' missing ./load_data.sh: 0: not found for i in 1 2 3 do ###some processing#### DLOG=$( eval echo \${TXPCY_${i}_DATA_FILE_LOG} )... (4 Replies)
Discussion started by: sandy162
4 Replies

7. Shell Programming and Scripting

Error when using certain directory path

Hi, I am using the following code to check if directory is empty: if ; then echo "There is no files in the input" sleep 60 fi And indir path is: /CH_ROOT/PRD/MAIN/INPUT/SDNTL/Interconnect Only when I am using the above path I get an error "too many arguments". I tried with 10... (4 Replies)
Discussion started by: apenkov
4 Replies

8. UNIX for Dummies Questions & Answers

directory checksum error

Hi, I have a tar file with naed ass bcs.tar.gz downlaoded to my work station and It contains all the .c files and .o which i needed. when i am trying to unzip this one i am facing directory checksum error. What does it mean.How to resolve this. I tried with tar -xf and tar -tvf... (2 Replies)
Discussion started by: jagan_kalluri
2 Replies

9. UNIX for Advanced & Expert Users

creating directory error

i have create a Directory with "$@#$%" . After creating a Directory, put ls command display "#$%" . Why? (2 Replies)
Discussion started by: lakshmananindia
2 Replies

10. UNIX for Dummies Questions & Answers

directory checksum error

Display warnning:directory checksum error in the end of Decompress the bag (0 Replies)
Discussion started by: renrongwen
0 Replies
Login or Register to Ask a Question