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


Bash | 9 comments | Create New Account
Click here to return to the 'Bash' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Bash
Authored by: lagroue on Mar 30, '06 08:24:57AM

I don't know enough the alias command in bash.

But as ~/bin is in my $PATH, I created the /bin/spot file with this content:

#!/bin/sh
mdfind -onlyin "`pwd`" $@ \
| sed s/^.\*\$/\"\&\"/g \
| xargs ls -lt \
| sed  s:"`pwd`"/:: \
| sed "s/^[-dltrwx]*\ *[0-9]*\ [a-z]*\ *[a-z]*\ *[0-9]*//"
Remove the \ on the end of line to put the whole command on a single line - leave the #!/bin/sh alone, though.

Then I made it executable :

~$ chmod +x bin/spot

And there I go !

~$ spot spot
 Mar 30 18:16 bin/spot
...

Not great bash, I guess. Still, thanks for this useful spot command !



[ Reply to This | # ]