[TUHS] /bin/true (was basic tools / Universal Unix)

Kurt H Maier khm at sciops.net
Fri Oct 20 09:27:28 AEST 2017


On Thu, Oct 19, 2017 at 05:14:49PM -0600, Grant Taylor via TUHS wrote:
> On 10/19/2017 05:00 PM, Dave Horsfall wrote:
> > Good luck with "cd"...
> 
> There's nothing that states that the executable effectively do anything. 

It's still useful.  Minimal example:

[khm at pc ~]$ (exec cd /); echo $?
0
[khm at pc ~]$ (exec cd /nosuchpath); echo $?
/usr/bin/cd: line 2: cd: /nosuchpath: No such file or directory
1

You can use this to dodge some of the crappier shells' problems,
sometimes, or to test for directory accessibility in a clean
environment.  I've run across it in the wild on occasion, even if I
don't really play this sort of game myself.

khm


More information about the TUHS mailing list