in reply to script-problem

You forgot to make your script executable, as this demo shows:
$ ls -l /usr/bin/perl -rwxr-xr-x 2 root root 2478418 Jan 16 2004 /usr/bin/perl $ rm -f print.pl $ echo '#!/usr/bin/perl' > print.pl $ echo 'print "Hello, world\n"' >> print.pl $ ls -l print.pl -rw------- 1 anonymous monk 39 Oct 20 11:33 print.pl $ ./print.pl bash: ./print.pl: /usr/bin/perl: bad interpreter: Permission denied $ chmod +x print.pl $ ls -l print.pl -rwx------ 1 anonymous monk 39 Oct 20 11:33 print.pl $ ./print.pl Hello, world
It's not that your she bang line is wrong as a previous poster suggested. If that was the case, you would get the message:
$ bash: ./print.pl: /usr/bin/perl: bad interpreter: No such file o +r directory
which you would also get if there were "unreadable" characters after 'perl' as the other posted suggested.

Replies are listed 'Best First'.
Re^2: script-problem
by Anonymous Monk on Oct 20, 2004 at 10:28 UTC
    hi guys, thanks for your very quick (!) help! unfortunately, neither one helped me get rid of my problem. here is some more output as requested:
    [12:28, 36deg, 31%] steppenwolf@baby:~/documents/perl$ la print.pl -rwxr-xr-x 1 steppenwolf steppenwolf 39 Oct 20 12:26 print.pl [12:28, 36deg, 31%] steppenwolf@baby:~/documents/perl$ which perl /usr/bin/perl [12:28, 36deg, 31%] steppenwolf@baby:~/documents/perl$ type perl perl is /usr/bin/perl [12:28, 36deg, 31%] steppenwolf@baby:~/documents/perl$ od -cx print.p +l 0000000 # ! / u s r / b i n / p e r l \ +n 2123 752f 7273 622f 6e69 702f 7265 0a6c 0000020 \n p r i n t ' h e l l o w +o 700a 6972 746e 2720 6568 6c6c 206f 6f77 0000040 r l d ! ' ; \n \0 6c72 2164 3b27 000a 0000047 [12:28, 36deg, 31%] steppenwolf@baby:~/documents/perl$
    does that help you?
        i'm sorry, that is not the case either.
        snippet from my /etc/fstab:
        /dev/hda7 /data ext3 user,auto 0 + 0
        i don't know if that matters, but i use debian unstable. and i'm quite lost with my problem right now :(...
        ok, i'm sorry, i fixed the problem. the filesystem wasn't mounted with the noexec option, but it wasn't mounted with the exec option either. after adding that to /etc/fstab everything works well now. thanks for your help!