Ubuntu: Making curl-derived data in stdout executable


I've downloaded a raw form of a bash script from my personal Github account, into stdout with curl and tried executing it with Bash:

curl https://raw.githubusercontent.com/user/repo/master/script.sh | bash  

This is the error I get:

ERROR: Bad port

Although the script itself works by manual copy-paste of each row, the command execution above fails, likely because the data aren't executable. I tried to make these data executable but failed:

curl https://raw.githubusercontent.com/benqzq/unse/master/unse.sh | chmod +x | bash  

Locally running the script also failed with different errors (404 for inner curl/wget commands, and breakage of some redirection commands):

wget -O https://raw.githubusercontent.com/user/repo/master/script.sh && chmod +x script.sh && bash script.sh && rm script.sh  

What might cause the problems in both methods?


1) I didn't find anything regarding making downloaded code executable in stdout, in the curl manual.

2) I usually avoid downloading scripts from personal Github accounts but as mentioned, this is my own account and I wrote the script myself. It's just a fast way to load and execute it on different machines.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »