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

Re: My bash script is missing something - what?



Le nonidi 19 vendémiaire, an CCXXV, Greg Wooledge a écrit :
> > That just fails differently by responding:
> > 
> > : No such file or directory
> 
> Carriage return.  Did you edit this script with a Microsoft Windows
> program, perhaps?  The shebang line (#!/bin/bash) probably ends with
> a carriage return + line feed, instead of just a line feed.

I had the same diagnosis. Note that modern shells print a more useful
diagnosis:

execve("/tmp/foo.sh", ["/tmp/foo.sh"], [/* 45 vars */]) = -1 ENOENT (No such file or directory)
open("/tmp/foo.sh", O_RDONLY|O_NOCTTY)  = 3
read(3, "#!/bin/sh\r\n", 64)            = 11
close(3)                                = 0
ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(2, "zsh:1: /tmp/foo.sh: bad interpreter: /bin/sh^M: no such file or directory\n", 74) = 74
exit_group(127)                         = ?

-- 
  Nicolas George

Attachment: signature.asc
Description: Digital signature


Reply to: