View previous topic :: View next topic |
Author |
Message |
toralf Developer
Joined: 01 Feb 2004 Posts: 3922 Location: Hamburg
|
Posted: Thu Jul 19, 2012 7:29 pm Post subject: [solved] find broken links except directory /proc |
|
|
Hhm, I'd like to extend thisto exclude /proc, /dev and /run.
Any ideas ?
Last edited by toralf on Thu Jul 19, 2012 8:54 pm; edited 1 time in total |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Thu Jul 19, 2012 8:00 pm Post subject: |
|
|
or something like:
Code: | find $(mount | awk '/ext4/ { print $3 }') ... |
Last edited by Ant P. on Thu Jul 19, 2012 8:02 pm; edited 2 times in total |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Thu Jul 19, 2012 8:01 pm Post subject: |
|
|
toralf ...
Untested ... but should work ... note I'm also excluding /sys as it'll no doubt cause issues.
Code: | find -L / -path '/proc' -prune -o -path '/dev' -prune -o -path '/run' -prune -o -path '/sys' -prune -o -type l -print |
best ... khay |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Thu Jul 19, 2012 8:48 pm Post subject: |
|
|
Ant P. wrote: | Code: | find $(mount | awk '/ext4/ { print $3 }') ... |
|
Ant ... this will always return / and so /proc /dev /run will be included in the path. Also, you can make the parsing a little more specific and less greedy
Code: | awk '$5 ~/ext4/{print $3}' <(mount) |
best ... khay
Last edited by khayyam on Thu Jul 19, 2012 8:54 pm; edited 1 time in total |
|
Back to top |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3922 Location: Hamburg
|
Posted: Thu Jul 19, 2012 8:53 pm Post subject: |
|
|
khayyam wrote: | toralf ...
Untested ... but should work ... note I'm also excluding /sys as it'll no doubt cause issues.
Code: | find -L / -path '/proc' -prune -o -path '/dev' -prune -o -path '/run' -prune -o -path '/sys' -prune -o -type l -print |
best ... khay | yes - Thx |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Fri Jul 20, 2012 1:42 am Post subject: |
|
|
toralf ...
your welcome ... the following might be a better solution, should work the same, its just shorter as it combines the paths to prune.
Code: | find -L / \( -path '/proc' -o -path '/dev' -o -path '/run' -o -path '/sys' \) -prune -o -type l -print |
best ... khay |
|
Back to top |
|
|
|