ip-abuse-lookup.sh

ip-abuse-lookup.sh

Posted by: yogabasics
Posted on: 2008-06-02 12:15:00

I'm trying to run the file "ip-abuse-lookup.sh" as described on: http://wiki.dreamhost.com/Block_IP_Abuse and I'm getting the following when run from my home dir:
./ip-abuse-lookup.sh
#: bad interpreter: No such file or director
(this is what is used in the wiki article) or
.ip-abuse-lookup.sh
-bash: .ip-abuse-lookup.sh: command not found
Can someone tell me what I'm doing wrong here??



Re: ip-abuse-lookup.sh

Posted by: patricktan
Posted on: 2008-06-02 19:08:00

You may want to try
sh ./ip-abuse-lookup.sh

Re: ip-abuse-lookup.sh

Posted by: Lensman
Posted on: 2008-06-02 20:24:00

You can also add the following as the first line of your shell script:

#!/bin/sh

Use the 3DOM50 promo code for 3 extra lifetime domains and $50 off
More Dreamhost coupons here!

Re: ip-abuse-lookup.sh

Posted by: yogabasics
Posted on: 2008-06-03 07:59:00

The #!/bin/sh is already on the first line of the script.

Re: ip-abuse-lookup.sh

Posted by: yogabasics
Posted on: 2008-06-03 08:00:00

I tried running that, but nothing seemed to happen. I went back to try the original commands and I'm still getting the same errors.

Any other thoughts??

Re: ip-abuse-lookup.sh

Posted by: patricktan
Posted on: 2008-06-03 18:19:00

if you run "which sh", what do you see?

Re: ip-abuse-lookup.sh

Posted by: Lensman
Posted on: 2008-06-03 19:07:00

Let's follow a basic debugging technique - simplify the problem.

Create a file named test.sh in your home directory. Put the following in it:

#!/bin/sh
echo hello world

chmod it to be executable - I use chmod u+x test.sh, but feel free to use your favorite permissions.

From your home directory, type

./test.sh

You should see the shell script execute and print "hello world" to your console.

Use the 3DOM50 promo code for 3 extra lifetime domains and $50 off
More Dreamhost coupons here!

Re: ip-abuse-lookup.sh

Posted by: yogabasics
Posted on: 2008-06-04 07:45:00

I was able to get the script running using "vim scriptname" and then "Hit i for insert mode, then right-click to paste your clipboard (the install script) contents, then hit Esc, type :wq (that's 'colon', 'w', 'q'), and press Enter to save and exit."

Not sure why this wouldn't work with uploading the file and then running it, as I have done this with other scripts and it worked fine. I did get back "/bin/sh" when I ran "which sh".

Thanks for all of your suggestions!

Re: ip-abuse-lookup.sh

Posted by: Alpicola
Posted on: 2008-06-04 16:56:00

If that's the case, then it's probably some sort of line ending thing. My guess would be that you probably uploaded the script using Windows line endings rather than Unix line endings which left the shell looking for "/bin/sh\r" rather than the appropriate "/bin/sh".

Whatever happened, it's good that you got it working the way you needed =)

Re: ip-abuse-lookup.sh

Posted by: patricktan
Posted on: 2008-06-04 18:24:00

If that is the case, I'll suggest OP to use FileZilla to upload your files. It automatically corrects the carriage return characters between windows and unix.
http://www.freerism.com/?page_id=10

Re: ip-abuse-lookup.sh

Posted by: houkouonchi
Posted on: 2008-06-13 14:12:00

After uploading the file you can simply run:
dos2unix <filename>

which will remove the weird end characters and stuff that things like word pad usually add (notepad I don't think typically adds these).

Tags: interpreterwiki