[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash handling of ENOENT on missing files and directories
From: |
Greg Wooledge |
Subject: |
Re: Bash handling of ENOENT on missing files and directories |
Date: |
Tue, 29 Aug 2017 09:21:41 -0400 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Tue, Aug 29, 2017 at 03:40:54PM +0300, Jonny Grant wrote:
> (B) is good, but (A) and (C) are problematic below.
>
> A)
> $ cd missingdir
> bash: cd: missingdir: No such file or directory
How is this a problem? It seems completely clear to me. It tells
you what program generated the error, what the program was trying to
do, what argument was given, and what the result was.
The wording is taken directly from perror() and related library calls,
as translated for your locale.
wooledg:~$ grep -r 'No such file' /usr/include
/usr/include/asm-generic/errno-base.h:#define ENOENT 2 /* No
such file or directory */
/usr/include/rpcsvc/nfs_prot.x: NFSERR_NOENT=2, /* No such file or
directory */
The magic phrase "No such file or directory" tells the aware reader
that some system call failed with errno set to ENOENT.
> C)
> $ ./main
> -bash: ./main: No such file or directory
Again, I'm not seeing the problem.