Skip to main content
The 2024 Developer Survey results are live! See the results

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.

6
  • 1
    Well, it works ok for me (at least the second one) so I suspect something else being amiss for the asker.
    – nohillside
    Commented Jan 28, 2013 at 9:19
  • @patrix Yeah, that is difficult to diagnose without knowing what the sourced file is meant to do. Judging from the comment threads, it is meant to setup aliases and completion functions, which won’t carry over from a subshell, of course. Amended my wording to reflect that.
    – kopischke
    Commented Jan 28, 2013 at 9:52
  • I doubt it's that process substitution doesn't work given the accepted answer here: superuser.com/questions/255260/bash-source-from-url
    – rich
    Commented Jan 28, 2013 at 19:36
  • 1
    I strongly doubt that accepted answer has actually been tested. On my OS X box, cat <(curl http://url.tld/file.sh) outputs file contents, cp <(curl http://url.tld/file.sh) /new/dest copies the file, and source <(curl http://url.tld/file.sh) fails.
    – kopischke
    Commented Jan 28, 2013 at 20:34
  • … or maybe different bash versions’ source builtin react differently to being passed a file descriptor through process substitution (AFAIK Ubuntu has been using bash 4 since 2010). Rephrased my answer to narrow down the specifics.
    – kopischke
    Commented Jan 28, 2013 at 21:02