Hi there. Right now I have a simple perl script that I'm trying to use to download some files from a FTP server, but for some reason that i don't understand it says ..
: bad interpreter: No such file or directory
When I try to run it. I have checked the location of both the ftp program and perl interpreter and they are both correct, and they are both definately installed and running just fine on my machine. I have no clue as to what is going on. The code is below
#!/usr/bin/perl $pdblist = $ARGV[0]; $ftp = "/usr/bin/ftp"; $ftptmp1="filename1.txt"; $ftphost1 = "ftp.rcsb.org"; $ftpdir1 = "pub/pdb/data/structures/all/pdb/"; $pdb = "pdb"; $ent = ".ent"; open(PDBLIST, "$pdblist") || die "ERROR: Unable to open $pdblist FILE: + $!\n"; print "$pdblist\n" while(<PDBLIST>) { @fields = split; $pdbname = $fields[0]; $pdbname =~ tr/[A-Z]/[a-z]/; $pdbfile = "$pdb$pdbname$ent"; # get pdb file from ftp site print "Retrieving $pdbfile file from FTP site ...\n"; open(FTP, "|$ftp -n $ftphost1 > $ftptmp1"); print FTP "user anonymous "; print FTP "password a.l.cuff\@qmul.ac.uk\n"; print FTP "cd $ftpdir1\n"; print FTP "bin\n"; print FTP "get $pdbfile\n"; print FTP "bye"; $pdbfileunzipped = substr($pdbfile, 0, 11); print "Decompressing $pdbfileunzipped ... \n"; system("gunzip $pdbfile"); }
Can anyone see something wrong with this that I'm not seeing? Any help much appreciated. Thank you.

In reply to ftp script problem .. bad interpreter? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.