macearl / Wallhaven-Downloader

A simple download Script for Wallhaven.cc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cant download any file

s7e7v7e7n7 opened this issue · comments

Hello macerl,

I hope you good and everything is fine...

i have a problem. now this bash script not work. i take this error. Can you fix ? Thank you.

http://image.prntscr.com/image/491bfee87a134ee49b4a2215b2695b21.jpeg

could you post the output of
ls -al $(which sh)
just want to make sure it points to bash, also try running the script directly with ./anime.sh in your case

i just saw that bash added negative substring length in 4.2, so also run bash --version

And im guessing your not on mac right? (would be weird on a server) But it seems i need to check if the negative substring length works there

[root@server wallpapers]# ls -al anime.sh

-rw-r--r-- 1 root root 13K Sep 8 10:47 anime.sh

i use centos 6.5 and use / bash 4.1.2(1)-release (x86_64-redhat-linux-gnu)

actually i use last one year this script. i cant see any problem. but now i have a problem...

i use directly this code i take this error.
[root@server wallpapers]# ./anime.sh
bash: ./anime.sh: Permission denied

this server is dedicated server and i connect root user on ssh.

thanks for help...

mmh i need to look into how many systems still use bash versions under 4.2 and then i decide if i will revert back to the old way, not really sure on this one, i dont like the sed version, but im also not too fond of the substring one either.

For now try to replace

img="${imgURL: 25 : -1}"
number="${img##*/}"

with:

img="$(echo $imgURL | sed  's .\{25\}  ' | sed 's/.\{1\}$//'
number="$(echo $img | sed  's .\{37\}  ')"

that should work. As for your permission error make sure the executable bit is set

macearl thank you for help but i take now this error;

[root@server wallpapers]# sh anime.sh
anime.sh: line 106: unexpected EOF while looking for matching `)'
anime.sh: line 320: syntax error: unexpected end of file

its not work. :(

sorry missed a couple of characters

img="$(echo $imgURL | sed  's .\{25\}  ' | sed 's/.\{1\}$//')"
number="$(echo $img | sed  's .\{37\}  ')"

hehe you are best :) now working perfect :)

thank you so much macearl...

I just wonder;

you can do similar bash script another site for fee?

i would have to take a look at it, but probably not for a while

ohh okay thanks. I just wondered. :)

you are best... have nice days...

mmh i need to look into how many systems still use bash versions under 4.2.

@macearl , FYI: macOS is still on ancient bash.

% echo $BASH_VERSION 
3.2.57(1)-release

so the current script throws the same error as in the first post? Im just gonna go back to the sed version for now