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


Click here to return to the 'A copout way to make it work with bash' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A copout way to make it work with bash
Authored by: googoo on Mar 30, '06 08:12:36AM
This is a copout, but you could make a bash-executible file that duplicates the commands of the csh alias. This works for me:

#!/bin/bash
mdfind -onlyin "`pwd`" "$*" | sed s/^.\*\$/\"\&\"/g| xargs ls -lt | sed s:"`pwd`"/:: | sed "s/^[-dltrwx]*\ *[0-9]*\ [a-z]*\ *[a-z]*\ *[0-9]*//"

The shebang (#!) line should be the first line in the file, and everything else should be on the second line. Save the file with the name spot, and run chmod 755 spot. Then, move the file to a directory in your path.

-Mark

PS. Nice hint!



[ Reply to This | # ]
A copout way to make it work with bash
Authored by: lagroue on Mar 30, '06 08:26:16AM

:o) Same idea, same moment !

You use $* ? I used $@ !
Who is right ?



[ Reply to This | # ]
A copout way to make it work with bash
Authored by: googoo on Mar 30, '06 11:26:06AM

I think it works either way. When double-quoted, $* expands to all of your arguments separated by spaces in one set of quotes. $@ expands to all your arguments. (When double-quoted, it expands to all your arguments, each double-quoted.) I think your way ($@) is actually cleaner because you can control how the arguments are passed to mdfind, but my brief tests found no actual differences in the results. When I changed the word order and used my "$*" version, I got the same files. I have not checked, but I think mdfind parses out all the words and returns files that have each.

-Mark



[ Reply to This | # ]