Re: Force exit status if file not found

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/3/7 Mikkel <mikkel@xxxxxxxxxxxxxxxx>:
> On 03/07/2011 04:08 PM, Sergio Belkin wrote:
>> Hi,
>> I am writing a script that it searchs for a file. I'd want to exit
>> with status non-zero if the file is not found. But find cannot do
>> that.
>> find command only exit with status non-zero one file is not processed
>> successfully.
>>
>> locate command con do that, but it cannot find a file from a given directory.
>>
>> How can I do it?
>>
>> Thanks in advance!
> You may want to look at the test command. (man test) It is often
> used in conjunction with the if command. You can also look at Bash's
> built in [ command.

Of course, I know about test command :)
But test command is useful if you know the complete file path.

 I've found an easier way in short something like:

 cd $i && ls -R   | egrep  -q "^configure.ac$|configure.in" && ls -R |
egrep -q "^Makefile.am$|Makefile.in"

HTH

>
> Mikkel
> --
>
>  Do not meddle in the affairs of dragons,
> for thou art crunchy and taste good with Ketchup!
>
>
>
>



-- 
--
Sergio Belkin  http://www.sergiobelkin.com
Watch More TV http://sebelk.blogspot.com
LPIC-2 Certified - http://www.lpi.org
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux