Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wget file and send it to Bash

I want to make a Bash script which has to use Wget and run its output with Bash like this:

wget -q -O - http://pastebin.com/raw.php?i=VURksJnn | bash

The pastebin file is a test script, but this commands shows me:

"Unknown command" (maybe due to new lines) and "Unexpected end of file", and I don't know why.

Am I missing something?

like image 924
Max13 Avatar asked May 02 '12 07:05

Max13


1 Answers

Your script has DOS line-endings.

If you convert the line endings to Unix line endings, it runs fine:

$ tr -d '\r' < raw.php\?i\=VURksJnn > script
$ cat script | bash
Test script
You're not root
End test
$ 
like image 57
sarnold Avatar answered Sep 21 '22 15:09

sarnold