You asked it to find something called "bin" or "sbin", not something containing "bin" or "shin". If the latter was the case it would return everything with "bin" or "sbin" in it, not just "ovs-pki".
You would be better putting the file you wanted in the find command, something like:-
I hope that this helps. It will find any file that matches the pattern with anything either side. The directory structure is not part of the pattern though, so if you want bin or sbin as part of the path, you may need to:-
The egrep expression "\/s*bin\/" will (I hope) match the string of / followed by zero or more s then bin and finally another /. Of course this will match /sssssssssbin/ too if you have one, but it's close.
Perhaps someone can tweak my expression to say "zero or one letter s"
You asked it to find something called "bin" or "sbin", not something containing "bin" or "shin". If the latter was the case it would return everything with "bin" or "sbin" in it, not just "ovs-pki".
ovs-pki is located in /usr/bin/, {} contains /usr/bin/, why ls {} doesn't ouput it ?
---------- Post updated at 10:29 AM ---------- Previous update was at 10:27 AM ----------
Quote:
Originally Posted by rbatte1
You would be better putting the file you wanted in the find command, something like:-
I hope that this helps. It will find any file that matches the pattern with anything either side. The directory structure is not part of the pattern though, so if you want bin or sbin as part of the path, you may need to:-
The egrep expression "\/s*bin\/" will (I hope) match the string of / followed by zero or more s then bin and finally another /. Of course this will match /sssssssssbin/ too if you have one, but it's close.
Perhaps someone can tweak my expression to say "zero or one letter s"
I hope that this helps,
Robin
my case actually want to output all the cmds in bin/ or sbin/, the really question is why it doesn't output ovs-pki, though it's located in /usr/bin
As I said, {} contains "bin", but it isn't called "bin". If "ovs-pki" was a directory and its contents included a file or directory called "bin", then it "ovs-pki" would show up in the search. That's because it's looking for things you asked it to. It would only report "ovs-pki" if it contained something called "bin" ("bin" being the thing you asked it to find).
As I said, {} contains "bin", but it isn't called "bin". If "ovs-pki" was a directory and its contents included a file or directory called "bin", then it "ovs-pki" would show up in the search. That's because when it finds what you asked it to it stops. It doesn't find "bin" and then think to itself "Hmmm. I'll just keep going for a minute"
no,no,no can you run below command, it actually output the cmds, which in bin or sbin
Greetings,
For housekeeping, I use the following command:
find /some/path -type f -name "*log*" ! -exec fuser -s "{}" 2>/dev/null \; -exec ls -lh {} \;
It finds all log files not currently in use by a process and manipulates them.
This command always works on linux and redhat machines,... (2 Replies)
I have the following files in a directory
> ls -1 /tmp/test/dir/
file with spaces 1.ogg
file with spaces 2.oggI am running the following to echo the filenames but alter the file extension on the files to .mp3 instead of .ogg ( I am going to run ffmpeg against the files ultimately, but keeping... (2 Replies)
Hi,
We are using a shell script which is called from COBOL program. Here the program works fine till we are using MicroFocus(MF) COBOL 4 and UNIX AIX 5.3.
Recently we have upgraded to MicroFocus(MF) COBOL 5.1 but same AIX version. now the shell script not working as expected.
The shell... (5 Replies)
Hi,
I am using the korn shell on Solaris box.
Why does the following 2 commands return different results?
This command returns no results (I already used this command to create a list of files which I moved to an archive directory)
find ????10??_*.dat -type f -mtime +91
However this... (15 Replies)
Hi,
I've a find command like,
find /abcd/efgh -name "xxxx" 2> /dev/null > file1
what would be the condition to check if this returns none(means if the file "xxxx" is not present) ????
I tried checking with $? and it returns 72 to me but even the file is present also it returns... (6 Replies)
Hi all does find command return anything if the file to be searched is not found? Like if I search from a file in a dir does it return false or null if the file is not found? Please suggests. (3 Replies)
Hi,
i wan to search the file starting with Admin into the directory Output. I am running below command:
find /appl/Output -name "Admin*" -prune
but this command is going into the sub directories present under output. I do not want to search under sub directories. Any help will be highly... (6 Replies)
I have a script with a find command using xargs to copy the files found to another directory. The find command is finding the appropriate file, but it's not copying. I've checked permissions, and those are all O.K., so I'm not sure what I'm missing. Any help is greatly appreciated.
This is... (2 Replies)