SPUG: No such file?

Tim Maher/CONSULTIX tim at consultix-inc.com
Fri Jan 28 22:54:12 CST 2000

On Fri, Jan 28, 2000 at 07:43:11PM -0800, Andrew Sweger wrote:
> On Jan 28, 2000 @ 5:48pm, William Julien wrote:
> > >What is going on here?
> > >
> > >bash-2.03$ app.pl
> > >bash: ./app.pl: No such file or directory

Part of the problem here is that when the exec* system call cannot
find the designated pathname, it gives a "stock" error message, instead
of a useful one, like:

bash: ./app.pl: "/usr/bin/perl
":  No such file or directory

> > 
> > Let me guess. Was the program was written on a winbox and uploaded to a unix
> > server in binary mode? So, the unix shell sees the dos line end character
> > on the header. In a "real man's editor"... like uh, ... vi!; you would see:
> > "/usr/bin/perl^M".  Guess what... there is "No such file or directory"
> > by that name!

Just to avoid this SNAFU at all costs in the future, I think I'll execute
	#  ln /usr/bin/perl '/usr/bin/perl^M'
next time I talk to a shell rootily!

I almost had the right idea.  I recognized the error message as the same
one I see when my students type #! /usr/perl/bin , so I thought it might
be a trailing space (left after "perl -w" was converted to "perl "), on
some Lame UNIX-like OS that didn't ignore trailing white-space there.
(Seems to me I encountered an OS like that somewhere, along with one
that could handle #! path  but not #!path.)

So close, yet so far!  And it really irks me that VI (or William Julien,
same thing 8-,) ended up being the hero of the story! 8-} 

How are we ever going to get rid of this abomination, this egregiously
pessimal example of ergonomic design (viz., VI), if people keep pointing
out good things about it? 8-}

> Wow! My mystery is solved. Every once in a while this would happen to me.
> About as often as I'm forced to edit a script on a system with MS-DOS in
> its family tree. I never made the connection and hadn't thought to examine
> the file contents itself. I usually just nuked it and started over. And
> all I needed was a quick,
> tr -d "\r" < f1 > f2

To further delay the onset of carpal-tunnel syndrome, I prefer this: 
	col < f1 > f2
(although it will remove any formfeeds in your file too)

But my primary use for the widely ignored "col" command is removing
"overstriking by backspacing", so I can grep within man-pages:

	$ man date | grep NAME
	$ man date | col -b | grep NAME		# convert a^Ha to a, etc.

> Or, if you prefer Perl,
> perl -pi -e 'y;\r;;d;' f1

As a famous educator once opined:
	When on UNIX, only the clueless, masochists, Windows trained,
	or rabid Perl bigots would prefer ugly custom Perl programs
	with complex syntax to much simpler alternatives like "col".

Other things being equal, of course.  But once you factor in the coolosity
of insanely wonderful features like "-i f1" vs "<f1  >f2", Perl wins hands

> Thanks for explaining it.


> -- 
>   Andrew Sweger <andy at n2h2.com>  |  N2H2, Incorporated
>   v=206.336.2947 f=206.336.1541  |  900 Fourth Avenue, Suite 3400
>      Advanced Technologies       |  Seattle WA 98164-1059
>           Development            |  http://www.n2h2.com/

| Tim Maher, PhD  Consultix &              (206) 781-UNIX/8649           |
|  Pacific Software Gurus, Inc             Email: tim at consultix-inc.com  |
|  UNIX/Linux & Perl Training              http://www.consultix-inc.com  |
| 2/22: UNIX  2/28: Perl Modules  2/29: Int. Perl  3/3: Pattern Matching |

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address

More information about the spug-list mailing list