| View previous topic :: View next topic |
| Author |
Message |
toralf Advocate


Joined: 01 Feb 2004 Posts: 2407 Location: Hamburg/Germany
|
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. Veteran

Joined: 18 Apr 2009 Posts: 1917 Location: UK
|
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 Veteran


Joined: 07 Jun 2012 Posts: 1252
|
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 Veteran


Joined: 07 Jun 2012 Posts: 1252
|
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 Advocate


Joined: 01 Feb 2004 Posts: 2407 Location: Hamburg/Germany
|
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 Veteran


Joined: 07 Jun 2012 Posts: 1252
|
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 |
|
 |
|