Solved ksh vs sh - built in commands ?

Hello guys, please look at the following date commands.
It looks like KornShell uses its own application. Built in? And why? Any idea?
It appeared after this shell has been updated to ksh93-20141224 from 2012... .

Code:
user@serv:~ % ksh -c "date -r"
date: -r: unknown option
Usage: date [-aceEiLlmnRsuz] [-d date] [-f format] [-p format] [-T type] [-U scale] [ +format | date ... | file ... ]

user@serv:~ % sh -c "date -r"
date: option requires an argument -- r
usage: date [-jnRu] [-d dst] [-r seconds|file] [-t west] [-v[+|-]val[ymwdHMS]]
            [-I[date | hours | minutes | seconds]]
            [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
 
According to the man pages, neither sh nor ksh has date as a built-in date command. I would begin debugging by executing "which date" in both shells, see what you get. The second one (which you get from sh) looks like the standard FreeBSD date command, which is installed in /bin/date.
 
There is standard date command in sh.
It looks like ksh uses standard path to date.
I cannot find another date executable file.

Code:
user@serv:~ % date -r
date: option requires an argument -- r
usage: date [-jnRu] [-d dst] [-r seconds|file] [-t west] [-v[+|-]val[ymwdHMS]]
            [-I[date | hours | minutes | seconds]]
            [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]

user@serv:~ % /bin/date -r
date: option requires an argument -- r
usage: date [-jnRu] [-d dst] [-r seconds|file] [-t west] [-v[+|-]val[ymwdHMS]]
            [-I[date | hours | minutes | seconds]]
            [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]

user@serv:~ % ksh -c "date -r"
date: -r: unknown option
Usage: date [-aceEiLlmnRsuz] [-d date] [-f format] [-p format] [-T type] [-U scale] [ +format | date ... | file ... ]

user@serv:~ % ksh -c "which date"
/bin/date

user@serv:~ % sh -c "which date"
/bin/date

user@serv:~ % ksh -c "whereis date"
date: /bin/date /usr/share/man/man1/date.1.gz /usr/src/bin/date

user@serv:~ % sh -c "whereis date"
date: /bin/date /usr/share/man/man1/date.1.gz /usr/src/bin/date

user@serv~ % ksh -c "stat -x /bin/date"
  File: "/bin/date"
  Size: 36080        FileType: Regular File
  Mode: (0555/-r-xr-xr-x)         Uid: (    0/    root)  Gid: (    0/   wheel)
Device: 0,98   Inode: 561849    Links: 1
Access: Thu May 30 18:16:35 2019
Modify: Wed Dec 26 00:10:24 2018
Change: Sun May 19 11:03:28 2019

user@serv~ % sh -c "stat -x /bin/date"
  File: "/bin/date"
  Size: 36080        FileType: Regular File
  Mode: (0555/-r-xr-xr-x)         Uid: (    0/    root)  Gid: (    0/   wheel)
Device: 0,98   Inode: 561849    Links: 1
Access: Thu May 30 18:16:35 2019
Modify: Wed Dec 26 00:10:24 2018
Change: Sun May 19 11:03:28 2019

user@serv~ % ksh -c "/bin/date -r"
date: option requires an argument -- r
usage: date [-jnRu] [-d dst] [-r seconds|file] [-t west] [-v[+|-]val[ymwdHMS]]
            [-I[date | hours | minutes | seconds]]
            [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]

 
There is standard date command in sh.
Not on my machine (FreeBSD 11.2-RELEASE):
Code:
> which sh
/bin/sh
> ls -lF /bin/sh
-r-xr-xr-x  1 root  wheel  127704 Jul  1  2018 /bin/sh*
# Note that this is much smaller than the bash executable, so it is the real sh that ships with the base FreeBSD.
# I don't have ksh installed
> /bin/sh
... shell starts
$ which date
/bin/date
$ date -r
date: option requires an argument -- r
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
            [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]

Maybe you mixed up ksh and sh above?
 
Code:
FreeBSD$ mksh -c 'date -r 9'
Thu Jan  1 00:00:09 UTC 1970
FreeBSD$ csh -c 'date -r 9'
Thu Jan  1 00:00:09 UTC 1970
FreeBSD$ sh -c 'date -r 9'
Thu Jan  1 00:00:09 UTC 1970

Maybe you have to configure the PATH ?

The oksh (OpenBSD Korn Shell) has some annoying bugs too.
 
No, the problem has been solved with new realease.

ksh93-2020.0.0.a1,1 AT&T KornShell 93
 
Back
Top