[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Article Sample



[cc'ed to seul-dev-help, since maybe somebody here wants to take this and
use it in other contexts.]

> Well, one thing we need is sample data, and what better sample data than
> real articles?  I just whipped something up we can put in there as a
> start.  Feel free to comment on the content as well as how we're going
> to put it in the DB.
> ----------------
> Problem: I'm trying to run a program or script named foo, and the shell
> keeps telling me
> "bash: foo: No such file or directory".  foo does exist, and it is
> executable.  What gives?
> Author: Micah Yoder
> Version: 0.9
> 
> Open the file foo with a text editor and look at the first line.  If it

Woah. If it's a binary, some text editors will get confused. Why not suggest
they use the 'file' program first, to get a first guess? If it's a
binary and has this problem, then the rest of this taskhelp doesn't
help them at all.

If it is a binary, one possibility is that it's a glibc-based program
and their system is libc-based, or vice versa. It sucks that this is
the error message for that. strace will get you somewhere in trying to
diagnose the problem, but often not far enough.

> begins with #!, then
> it could be referring to a nonexistent program, or one that is installed
> in a different
> place than expected.  #! tells Linux to run the following program,
> passing the name of
> the executed file as an argument.  If it can't find the specified
> program, you will get
> this error.
> 
> A common example is a Perl script that you get off a CD or from the
> Web.  Many script writers
> assume Perl is installed in /usr/local/bin, so the script starts out
> like this:
> 
> #!/usr/local/bin/perl
> 
> But most modern Linux distributions install Perl as /usr/bin/perl. 
> First, we need to be sure
> our system has Perl, and find out where it is located.  This is the
> easiest way:
> 
> $ which perl

don't forget where perl or whereis perl, depending on shell..
speaking of, it might be useful to include the equivalent of the
"command not found" from each shell type.
 
> If the output is '/usr/bin/perl', or another location, then you're in
> luck.  You know Perl
> is installed and you know where it is.  If that doesn't work, Perl is
> not in your path and
> you will have to do some searching.  Perhaps you have not installed it. 
> If you're sure you
> have installed it, you can try this:
> 
> $ find / -name perl -print
> 
> Hopefully it will then print out the location of the Perl interpreter. 
> You can test it to
> be sure:
> 
> $ /...path reported by find.../perl -e "print 'test'";
> 
> Note: If your case is not Perl, then simply attempt to run the command,
> passing an argument
> you expect it to like, for example, the filename of the script you're
> trying to run.
> 
> Once you have determined the path of the program, you have three options
> to fix the problem:
> 
> 1.  Edit the first line of the script so that it refers to the correct
> path of the program.
> It will require that you have permission to edit (write to) the script
> file.
> 
> 2.  Add a symbolic link that will make the script correct as it is. 
> This will require
> that you have write permission to the directory pointed to by the
> script.  Here's how to
> do it with our Perl example:
> 
> $ ln -s /usr/bin/perl /usr/local/bin/perl
> 
> The first argument is the actual path and filename and the second is
> what follows #! in the
> script.
> 
> 3.  Run the script by typing the correct full pathname of the program
> referred to (you can leave
> out the full pathname if the which command found it), followed by the
> name of the script
> as an argument:
> 
> $ /usr/bin/perl foo
> $ perl foo
> 
> This is your only option if you are a non-root user and can't edit the

only? this may seem pedantic, but copy the file somewhere and edit it.

alternatively, add /usr/local/bin/ to your path.

> script file.  Of
> course, if that's the case, you should have a talk with your system
> administrator.
 
--Roger