Skip to content

[##---] an experimental minimal find-like command that only use POSIX shell built-in functions

Notifications You must be signed in to change notification settings

tst2005sh/sh-findlike

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

It is an experimental minimal find-like command that only use POSIX shell built-in functions

Features

  • mindepth
  • maxdepth
  • filter type
  • search for deadlink

Supported type

  • ! not exists (or permission denied)
  • f file
  • d directory
  • s socket
  • p pipe (FIFO)
  • b block special file
  • c character special file
  • U unknown
  • lX symlink of type X (like l!, lf, ..., lU)
  • l! dead [sym]link
  • lf symlink to file
  • ld symlink to directory

Sample of use

$ ./findlike showall tests-data
d tests-data (0)
f tests-data/-h (1)
lf tests-data/a_symlink_file (1)
d tests-data/bin (1)
f tests-data/bin/a_file (2)
d tests-data/emptydir (1)
l! tests-data/nonex (1)
lf tests-data/pass.symlink (1)
ld tests-data/x (1)
$ ./findlike showdeadlink tests-data
tests-data/nonex
$ ./findlike showdir tests-data
0 tests-data
1 tests-data/bin
1 tests-data/emptydir
1 tests-data/x
$ ./findlike showfile tests-data
1 tests-data/-h
1 tests-data/a_symlink_file
2 tests-data/bin/a_file
1 tests-data/pass.symlink
$ MINDEPTH=0 MAXDEPTH=0 ./findlike showdir tests-data
0 tests-data
$ MINDEPTH=1 MAXDEPTH=1 ./findlike showdir tests-data
1 tests-data/bin
1 tests-data/emptydir
1 tests-data/x
$ MINDEPTH=2 ./findlike showfile tests-data
2 tests-data/bin/a_file
$ MINDEPTH=3 ./findlike showfile tests-data

About

[##---] an experimental minimal find-like command that only use POSIX shell built-in functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages