Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] find broken links except directory /proc
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3920
Location: Hamburg

PostPosted: Thu Jul 19, 2012 7:29 pm    Post subject: [solved] find broken links except directory /proc Reply with quote

Hhm, I'd like to extend this
Code:
find -L / -type l
to 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
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Thu Jul 19, 2012 8:00 pm    Post subject: Reply with quote

Code:
-xdev

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
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Thu Jul 19, 2012 8:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Thu Jul 19, 2012 8:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3920
Location: Hamburg

PostPosted: Thu Jul 19, 2012 8:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Fri Jul 20, 2012 1:42 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum