[Bash] ftp links checken

Pagina: 1
Acties:

  • scorpie
  • Registratie: Augustus 2001
  • Laatst online: 00:25

scorpie

Supra Addict

Topicstarter
Ok, ik wil dus een klein bash scriptje schrijven om ftp adressen uit een tekst bestandje te checken.

Dit doe probeer ik dmv onderstaand scriptje:
code:
1
2
3
4
5
status=$(for i in `cat ftplist.txt`; do ftp $i)
if [ -z $status]; then
echo Cannot establish connection.
else
echo "Blaat"


Dit werkt niet, ik krijg alleen maar te zien, cannot establish connection.
Ik snap niet waar de fout ligt, want met "ftp <willekeurig ftp adres>" werkt het wel.

Ik heb gezocht op allerlei combinaties met keywords als: bash, scripting, ftp, status en ga zo maar door op zowel google als GoT, het enige wat ik terugkrijg zijn advanced bash docs waar ik ook niks in heb kunnen vinden...

wie gaat mij helpen? :)
bvd :>


edit:
solly .oisyn, ik kwam in de search meer bash topics tegen in p&w dan in nos, dus vandaar dat ik em daar plaatste :)

[ Voor 11% gewijzigd door scorpie op 04-12-2003 16:20 ]

wil een Toyota Supra mkIV!!!!! | wil een Yamaha YZF-R{1,6} | wil stiekem ook een Ducati
"Security is just a state of mind"
PSN: scorpie | Diablo 3: scorpie#2470


  • .oisyn
  • Registratie: September 2000
  • Laatst online: 22:12

.oisyn

Moderator Devschuur®

Demotivational Speaker

Give a man a game and he'll have fun for a day. Teach a man to make games and he'll never have fun again.


  • ge-flopt
  • Registratie: Februari 2001
  • Laatst online: 23-02 16:41
Het lijkt erop dat het commando ftp geen info terug geeft. Wat krijg je als je als je 1 van de ftp sites met de hand benaderd?

  • scorpie
  • Registratie: Augustus 2001
  • Laatst online: 00:25

scorpie

Supra Addict

Topicstarter
dan krijg ik gewoon dit:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
ftp ftp://<user>:<pass>@<location>/
Connected to <location>.
220-Welcome to Pure-FTPd.
220-You are user number 1 of 5 allowed.
220-This is a private system - No anonymous login
220 You will be disconnected after 15 minutes of inactivity.
Remote system type is UNIX.
Using binary mode to transfer files.
331 User <user> OK. Password required
230-User <user> has group access to:  1000
230 OK. Current restricted directory is /
200 TYPE is now 8-bit binary
250 OK. Current directory is /
ftp>


alles werkt dus gewoon goed (toch? ;))

wil een Toyota Supra mkIV!!!!! | wil een Yamaha YZF-R{1,6} | wil stiekem ook een Ducati
"Security is just a state of mind"
PSN: scorpie | Diablo 3: scorpie#2470


  • ge-flopt
  • Registratie: Februari 2001
  • Laatst online: 23-02 16:41
Moet je dan niet zorgen dat ftp ook afsluit voordat die info in de variable status komt?

  • CyBeR
  • Registratie: September 2001
  • Niet online

CyBeR

💩

wat staat er in je ftplist filetje? doe voor de gein ook eens dit:

for i in `cat ftplist`; do echo ftp $i; done

All my posts are provided as-is. They come with NO WARRANTY at all.


  • scorpie
  • Registratie: Augustus 2001
  • Laatst online: 00:25

scorpie

Supra Addict

Topicstarter
ge-flopt schreef op 05 december 2003 @ 14:15:
Moet je dan niet zorgen dat ftp ook afsluit voordat die info in de variable status komt?
hmmm good thinking ;)

@Cyber:
dan krijg ik de output:
ftp <ftp adres>
ftp <ftp adres>
...

wil een Toyota Supra mkIV!!!!! | wil een Yamaha YZF-R{1,6} | wil stiekem ook een Ducati
"Security is just a state of mind"
PSN: scorpie | Diablo 3: scorpie#2470


  • pinball
  • Registratie: Oktober 1999
  • Niet online

pinball

Electric Monk

jvhaarst in "script laten wachten op output telnet"

2 posts daarboven staat ook een perl scriptje wat met 2 aanpassingen doet wat jij wil.

Whenever you find that you are on the side of the majority, it is time to reform.

Pagina: 1