Search for file, give error if more than one file is found


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Search for file, give error if more than one file is found
# 15  
Old 04-03-2012
Try moving your ~/.mozilla or ~/.firefox directory and letting it create a new one. We can't see what you're doing when you can't even use your enter key.
# 16  
Old 04-03-2012
file="" testfile $file no files have been found

---------- Post updated at 04:06 PM ---------- Previous update was at 04:05 PM ----------

Quote:
Originally Posted by Corona688
Try moving your ~/.mozilla or ~/.firefox directory and letting it create a new one. We can't see what you're doing when you can't even use your enter key.
It's really bad. I am on Firefox. sdf sdfsd sdf
# 17  
Old 04-03-2012
Have you tried moving your .mozilla or .firefox folders somewhere else yet?
# 18  
Old 04-03-2012
Big question. Wondering whether the target for the "ls" is files or directories? This is because you have used the "-r" parameter to "ls" which implies directories.

What do you get for:
Code:
ls -lad *.base


Last edited by methyl; 04-03-2012 at 06:19 PM.. Reason: add words and layout
# 19  
Old 04-03-2012
with the ls I want to search for files.

---------- Post updated at 04:36 PM ---------- Previous update was at 04:34 PM ----------

This is what I want to do

Code:
file="" 
testfiles $file 
no file found    

testfiles /etc/passwd   
print nothing    

testfiles /etc/slartibartfast  
file does not exist   

testfiles file1 file2 file3 file4 file5 
5 files found. Program requires only one input file

# 20  
Old 04-03-2012
And that is exactly what it does, too. Have you tried it?

It also returns error codes, so you can use it in if-statements and things.
# 21  
Old 04-03-2012
Quote:
Originally Posted by Corona688
And that is exactly what it does, too. Have you tried it?

It also returns error codes, so you can use it in if-statements and things.
how can I use the error code?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash to search file for string and lauch function if found

In the bash below I am searching the filevirus-scan.log for the Infected files: 0 line (in bold) and each line for OK. If both of these are true then the function execute is automatically called and processing starts. If both these conditions are not meet then the line in the file is sent to the... (2 Replies)
Discussion started by: cmccabe
2 Replies

2. Shell Programming and Scripting

Bash - trap error file not found

Hello. In bash, is there a way to trap error "file not found" when a script call another script which is not found; then abort. Example ( part of script running with -x option set) : + return 0 + RETURN_CODE=0 + ] + /root/bin/200_yast_install/00_reset_yast_install bash:... (5 Replies)
Discussion started by: jcdole
5 Replies

3. Shell Programming and Scripting

Search row by row from one file to another file if match is found print few colums of file 2

this is the requirement list.txt table1 table2 table3 testfile.txt name#place#data#select * from table1 name2#place2#data2#select * from table 10 innerjoin table3 name2#place2#data2#select * from table 10 output name place table1 name2 place table3 i tried using awk (7 Replies)
Discussion started by: vamsekumar
7 Replies

4. AIX

ksh file not found error for various files across system

Our AIX system is currently having an issue where calls to various executables are returning errors such as ksh: /usr/bin/oslevel: not found. This is even happening with system files, third party scripts, and with the full path included. Telnet connections are also closing immediately upon... (6 Replies)
Discussion started by: Chthonic
6 Replies

5. Shell Programming and Scripting

bash script search file and insert character when match found

Hi I need a bash script that can search through a text file and when it finds 'FSS1206' I need to put a Letter F 100 spaces after the second instance of FSS1206 The format is the same throughout the file I need to repeat this on every time it finds the second 'FSS1206' in the file I have... (0 Replies)
Discussion started by: firefox2k2
0 Replies

6. Programming

Error found while opening any pdf file from IE 6

Hello All, My application is followed J2ee architecture. It contains Java and jsp codes. This application generates some reports in pdf format. I am using Weblogic 10.3 and jdk 6. While I want to open the pdf in IE 6 with service pack 2 , the pdf not showing properly. It comes in byte code.... (3 Replies)
Discussion started by: priyankak
3 Replies

7. Shell Programming and Scripting

file not found error during loop

Hi, I have a strange problem and I'm sure its because I'm doing something stupid. When I loop through all of the files in a directory they cannot be found. Any help would be greatly appreciated. Thanks, -E $ touch a.txt $ touch b.txt $ ls a.txt b.txt $ for f in `ls` ; do... (3 Replies)
Discussion started by: earls
3 Replies

8. Shell Programming and Scripting

source a property file in script give error

I have sourced a property file in my script like this to load some variables in the script Then i am able to echo all the property file values inside script but the script is not able to recognize other unix commands #!/bin/bash . build.properties mkdir build i am getting error ... (3 Replies)
Discussion started by: codeman007
3 Replies

9. Shell Programming and Scripting

search for a file, if not found sleep and repeat it for 3 hrs

Hi, Can someone help me with this script .... I need a ksh script, which will search for a specific file in a directory, if file not found sleep for 10 mins and search again, if still not found sleep again for 10 mins and so on .... it should search for that file for 3 hours and if that file... (5 Replies)
Discussion started by: santosham
5 Replies

10. Programming

Not able to compile Pro*c file due - give errors and points to /usr/include/.. file

I am trying to compile the pro*C file but gives errors. It says it encountered "std" while it was expecting ; , = ( $ $ORACLE_HOME/bin/proc tradewind/dataaccess/Blob.pcc Pro*C/C++: Release 10.2.0.3.0 - Production on Fri May 9 11:10:54 2008 Copyright (c) 1982, 2005, Oracle. All rights... (0 Replies)
Discussion started by: shafi2all
0 Replies
Login or Register to Ask a Question