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

Timeline for Source a script from a URL in bash

Current License: CC BY-SA 3.0

15 events
when toggle format what by license comment
Jan 28, 2013 at 8:26 answer added kopischke timeline score: 2
Jan 27, 2013 at 15:55 comment added kopischke In my defence, even the TLDP is confused when it comes to the semantics of process substitution. After scouring Stack Overflow, it almost looks like I could be accidentally half right: some programs apparently do not handle the fact well that the “file” they get passed is a file descriptor or named pipe (underlying implementation is OS dependent). source might be one of them.
Jan 27, 2013 at 15:39 comment added kopischke Hmm, reading up on process substitution, yeah, looks like that is what should happen – seems I’m mistaken. The only thing I can think of is that you are running into an asynchronous delay issue, as process substitution puts its job into the background.
Jan 27, 2013 at 14:19 comment added rich Surely that first line is passing it as a file, not piping it?
Jan 27, 2013 at 13:52 comment added kopischke That is not an ordinary file, that is a file descriptor, like stdin, stderr and stdout. You can’t use it directly in stead of a file because you are piping its contents into source, not passing it as a file. Try using a temp file created with mktemp (which is available on OS X and will mitigate security issues when executing code from a file not under your control; also, you can and should leave cleaning it to the OS’ flushing of /tmp).
Jan 27, 2013 at 13:09 comment added rich The <() construct uses a special file; /dev/fd/63.
Jan 26, 2013 at 23:27 comment added kopischke Yeah, my bad, sorry for not reading the post carefully enough. Actually, the issue seems to be the fact source only reads from files, not from stdin – according to the bash man page, that is.
Jan 26, 2013 at 23:10 comment added rich There's nothing wrong with the curl. As in the original post, a three line separate download, source and then removal of the temporary file works.
Jan 26, 2013 at 22:59 comment added kopischke Of course there is no error message, as the -s switch puts curl into silent mode. Try running it with the -sS switch instead and see what failure message you get.
Jan 26, 2013 at 11:40 comment added rich I want to put it in my ~/.bashrc, I've tried running it at a bash prompt too. No error message. Just the aliases within it aren't available, the bash completion of SSH hostnames it sets up doesn't work, etc.
Jan 26, 2013 at 10:46 comment added nohillside Do you get an error message of some kind?
Jan 26, 2013 at 0:20 answer added NaWi at Mac timeline score: 1
Jan 25, 2013 at 23:15 review First posts
Jan 25, 2013 at 23:16
Jan 25, 2013 at 23:05 comment added Phorce What do you mean, it doesn't work? Are you trying to execute this in a bash script or..?
Jan 25, 2013 at 22:58 history asked rich CC BY-SA 3.0