change directory command solved

Linux specific questions.
Post Reply
honeydatax
Posts: 26
Joined: Jul 11, 2021 11:55

change directory command solved

Post by honeydatax »

im building my one commands of bash but im have fond a command it is impossible to replicate
the command bash cd change directory only change directory of current program not parents directory can im use c to change the parent directory just try "curdir" and system variable eviron "pwd" but nothing change the parent command line? thanks :)


https://github.com/honeydatax/fbc-bash
Last edited by honeydatax on Aug 29, 2021 7:52, edited 1 time in total.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: change directory command

Post by caseih »

In Linux, or any posix system, no process can change the current working directory of its parent. It can only change it for itself and subsequently spawned processes. That's why cd is built into bash and is not a separate binary, unlike cat, ls, less, grep, etc.

I discovered that FreeBSD ships with a binary called /usr/bin/cd, and it works like the build-in cd, but it's for a different purpose and has no effect on the shell's current working directory when you run it, for the same reason I gave above.
honeydatax
Posts: 26
Joined: Jul 11, 2021 11:55

Re: change directory command

Post by honeydatax »

Thanks im discover other command than canot change the parent read , canot change eviron vars :)
honeydatax
Posts: 26
Joined: Jul 11, 2021 11:55

Re: change directory command

Post by honeydatax »

https://github.com/honeydatax/fbc-bash/ ... imeout.bas


Im building a timeout.bas
Program im want to put on console "./timeout 100 sleep 2" to stop program from go on from this time
But the process shell keep on runing wat is wrong :) ?
Thanks
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: change directory command

Post by caseih »

honeydatax wrote:Thanks im discover other command than canot change the parent read , canot change eviron vars :)
That's correct. You cannot change the environment of the parent process. That's also why manipulating environment variables is built into the shell and not done using external binaries.
honeydatax
Posts: 26
Joined: Jul 11, 2021 11:55

Re: change directory command

Post by honeydatax »

Im have other bug on my code; in my command line mini shellter ; if im call a process by mousepad & ; the process gets over the console input ; wat im can do to get input console wat im do wrong?
Thanks all been help

https://github.com/honeydatax/fbc-bash/ ... n/bash.bas
Post Reply