Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Find exit with success with non executable directory Post 302972676 by chebarbudo on Monday 9th of May 2016 11:36:13 AM
Old 05-09-2016
Find exit with success with non executable directory

Hi there,

I'm quite surprised by the following behavior of find.
Code:
$ find -ls                  # I have a directory and a file in it
  8145    4 drwxr-xr-x   3 me me     4096 May 10 09:36 .
    87    4 drwxr-xr-x   2 me me     4096 May 10 09:36 ./dir
    88    0 -rw-r--r--   1 me me        0 May 10 09:36 ./dir/file
$ chmod 111 dir/
$ find -ls; echo $?         # If the directory is not readable, find fails because it cannot explore it
  8145    4 drwxr-xr-x   3 me me     4096 May 10 09:36 .
    87    4 d--x--x--x   2 me me     4096 May 10 09:36 ./dir
find: `./dir': Permission denied
1
$ chmod 444 dir/
$ find -ls; echo $?         # If the directory is not cd-able, find does NOT fail with an error although it fails to find the file in it
  8145    4 drwxr-xr-x   3 me me     4096 May 10 09:36 .
    87    4 dr--r--r--   2 me me     4096 May 10 09:36 ./dir
0

I'm using a fresh install of Debian 8 jessie
Code:
$ uname -a; cat /etc/debian_version
Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u4 (2016-02-29) x86_64 GNU/Linux
8.3

How can I make sure find fails if it cannot list all files and folders?

Thanks in advance

Santiago

Last edited by chebarbudo; 05-10-2016 at 04:58 AM.. Reason: more details
 

10 More Discussions You Might Find Interesting

1. Programming

How to get exit value of an executable that gets called from function?

How to get exit value of an executable that gets called from function? I have an executable called “myexec” which returns 0 on success and different values for different fail scenarios. I need to call this (myexec) executable from “myprog()” function of other executable and get the exit value... (1 Reply)
Discussion started by: sureshreddi_ps
1 Replies

2. UNIX for Dummies Questions & Answers

Where can I find a list of exit codes? (Exit code 64)

I'm receiving an exit code 64 in our batch scheduler (BMC product control-m) executing a PERL script on UX-HP. Can you tell me where I can find a list of exit codes and their meaning. I'm assuming the exit code is from the Unix operating system not PERL. (3 Replies)
Discussion started by: jkuchar747
3 Replies

3. UNIX for Dummies Questions & Answers

Executable directory general question

This may be a dumb question (but this is the UNIX for Dummies Q&A forum :) But I'm wondering, what is the purpose of a directory being given execute permissions? I can't execute a directory, only files, right? If I make a directory executable, the files inside still won't execute unless I give... (1 Reply)
Discussion started by: FredSmith
1 Replies

4. Shell Programming and Scripting

how to exit with success if the file is not found

I want to put a exit if there is no file found. In the directory I can have multiple txt files with EPISGCHGS as prefix or maynot have one. When I am trying the following it is erroring if there is no text file with the EPISGCHGS as prefix. for file in EPISGCHGS*.txt do cat $file >... (2 Replies)
Discussion started by: apps_user
2 Replies

5. Shell Programming and Scripting

script to find latest executable in particular directory and start that particular ex

i have a directory in which there are executable files and these files are added at runtime. now i need a shell script which will be called at a certain interval. this shell script should find the latest executable file in that directory and start that executable. care should be taken that once the... (6 Replies)
Discussion started by: kvineeth
6 Replies

6. Shell Programming and Scripting

How to tar all executable file in a directory

Dear all I want to create a tar file which contains all executable files in a specific directory cd /appl/home/ file some_exe some_exe: 64-bit XCOFF executable or object module not stripped My current approach is to tar it one by one tar -cvf test.tar exefile1 tar -uvf test.tar... (2 Replies)
Discussion started by: on9west
2 Replies

7. Shell Programming and Scripting

Exit shell after setting executable to run?

Hi, I have an executable file that has a rather long and tedious process to complete. How would I launch the executable using the shell, and then exit the shell while leaving the executable to run in the background? (1 Reply)
Discussion started by: pcwiz
1 Replies

8. Shell Programming and Scripting

Finding the executable files of a directory using Grep

Hi guys, Can you please help me print all the executable files of a directory(in this case /home) using grep? All i know is that this command should do it but it doesnt... ls -l ~ | grep -..x it shows me the following mesage grep: invalid option -- '.' Χρήση: grep ... ΥΠΟΔΕΙΓΜΑ ... (3 Replies)
Discussion started by: jimas13
3 Replies

9. UNIX for Dummies Questions & Answers

Run executable in one directory and then move to another successively

Hello, I have several hundred subdirectories which contain input files for a binary executable. I need to get into each of the subdirectories, run the executable and then move to the next one and repeat the process. What is the best way to do this? Arbitrarily my file structures look like... (3 Replies)
Discussion started by: Gussifinknottle
3 Replies

10. UNIX for Dummies Questions & Answers

No such file or directory for existing executable

Hi, I have a very puzzling problem. I have a binary file, it is executable but it says "No such file or directory" when I try to run it : root@debian:~# ls -l bmcfwul -rwxr-xr-t 1 root root 762808 Mar 11 2010 bmcfwul root@debian:~# ./bmcfwul -su: ./bmcfwul: No such file or directory... (9 Replies)
Discussion started by: chebarbudo
9 Replies
tiobench(1)															       tiobench(1)

NAME
tiobench - Threaded I/O bench SYNOPSIS
tiobench [--help] [--nofrag] [--size SizeInMB [--size ...]] [--numruns NumberOfRuns [--numruns ...]] [--dir TestDir [--dir ...]] [--block BlkSizeInBytes [--block ...]] [--random NumberRandOpsPerThread [--random ...]] [--threads NumberOfThreads [--threads ...]] DESCRIPTION
tiobench is a perl wrapper to tiotest calling it multiple times with varying sets of parameters as instructed. OPTIONS --help Display a brief help and exit. --nofrag Instructs tiobench to pass -W to tiotest so it waits for previous threads to finish before starting a new one in the writing phase. For more info see the -W option in the tiotest(1) manpage. --size SizeInMB The total size in MBytes of the files may use together. If this option is not given, tiobench tries to be smart and figure out a size making sense. --numruns NumberOfRuns This number specifies over how many runs each test should be averaged. Defaults to 1. --dir TestDir The directory in which to test. Defaults to ., the current directory. --block BlkSizeInBytes The blocksize in Bytes to use. Defaults to 4096. --random NumberRandOpsPerThread Random I/O operations per thread. Defaults to 1000. --threads NumberOfThreads The number of concurrent test threads. Defaults to 4. The options --size, --numruns, --dir, --block, --random, and --threads may be given multiple times to cover multiple cases, for instance: tiobench --block 4096 --block 8192 will first run through with a 4KB block size and then again with a 8KB block size. To get usefull results the used file sizes should be a lot larger than the physical amount of memory you have. A good idea is to boot with 16 Megs of RAM (Try passing the "mem=16M" option to the kernel to limit Linux to using a very small amount of memory) and into Single User mode only. SEE ALSO
tiotest(1), bonnie(1), hdparm(8) AUTHOR
tiobench was written by James Manning <jmm@computer.org>. This manual page was written by Peter Palfrader <weasel@debian.org>, for the Debian GNU/Linux system (but may be used by others). Mar-2001 tiobench(1)
All times are GMT -4. The time now is 03:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy