Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


$PWD | 9 comments | Create New Account
Click here to return to the '$PWD' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
$PWD
Authored by: chleuasme on Mar 31, '06 06:40:55AM
you're certainly right

and I correct a bug when using the code of my previous post (when searching from / for example) :

function spot {
    LOC=$( { [ "$PWD" = / ] && echo /; } || echo . )
    mdfind -0 -onlyin "$PWD" "$@" |
    xargs -0 ls -lt |
    sed "s:^[-dltrwx]* *[0-9]* *[a-z]* *[a-z]* *[0-9]* *\([^/]*\)$PWD:\1  $LOC:"
}
you can also delete everything concerning the LOC variable here, or prefer the use of something like mdfind -0 -onlyin "$PWD" "kMDItemDisplayName = '$1'cd"" at the second line for fast by name search (but that imply to invoque the function with an escaped argument : beware the shell fiename expansion, in particular '*' wildcard)

[ Reply to This | # ]