Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • Does this work with aliases? I have one to download certain files but it isn't recognizing it when I type in find */.link -type f -execdir md $(cat .link) {} \; Commented Dec 5, 2014 at 15:51
  • @SomethingJones no, find executes those commands, so it wouldn't be aware of aliases. What is md and is the .link a directory? Commented Dec 5, 2014 at 15:52
  • .link is a text file that has the URL it needs to download. md is an alias to wget with a bunch of flags set. Is there a way to make it aware of aliases? Commented Dec 5, 2014 at 16:15
  • @SomethingJones For your particular use-case, in bash: find . -type f -iname '*.link' -execdir ${BASH_ALIASES[md]} -i {} \; You don't need to do cat with wget, which has an -i flag for reading in an URL from a file. Also this is somewhat different from your original question (since you seem to be interested in only files named .link and not any other files which may be present). Commented Dec 5, 2014 at 16:20
  • Do you know how to do that with zsh? I tried what you gave me and am getting a "Bad substitution" error. Also, how would I be able to extract the content of the .link file? I know I don't need it in this case but I imagine I will soon. Commented Dec 5, 2014 at 21:13