Knowing what directory a process started in Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionWhat does it mean each process has a current directory?When was a process startedHost process for multiple processes?How do I set an environment variable for sudo in MacOS?Setting the LANG environment variable for xfceHow to store / load exported environment variables to / from a fileWhy does this endless loop not use up my system resources?How to recover lost X windowsUnix - ps to check if script runningenvironment variables scriptMy Java environment variables seem to be a complete mess how do I make a clean start without reinstalling?

When were vectors invented?

Seeking colloquialism for “just because”

What causes the vertical darker bands in my photo?

Why was the term "discrete" used in discrete logarithm?

How to call a function with default parameter through a pointer to function that is the return of another function?

How to tell that you are a giant?

Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?

2001: A Space Odyssey's use of the song "Daisy Bell" (Bicycle Built for Two); life imitates art or vice-versa?

Storing hydrofluoric acid before the invention of plastics

How to bypass password on Windows XP account?

What does this icon in iOS Stardew Valley mean?

Can a non-EU citizen traveling with me come with me through the EU passport line?

How does debian/ubuntu knows a package has a updated version

What does an IRS interview request entail when called in to verify expenses for a sole proprietor small business?

ListPlot join points by nearest neighbor rather than order

How to override model in magento2?

Should I use a zero-interest credit card for a large one-time purchase?

Sci-Fi book where patients in a coma ward all live in a subconscious world linked together

What exactly is a "Meth" in Altered Carbon?

Identifying polygons that intersect with another layer using QGIS?

English words in a non-english sci-fi novel

The logistics of corpse disposal

When do you get frequent flier miles - when you buy, or when you fly?

How to find all the available tools in mac terminal?



Knowing what directory a process started in



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionWhat does it mean each process has a current directory?When was a process startedHost process for multiple processes?How do I set an environment variable for sudo in MacOS?Setting the LANG environment variable for xfceHow to store / load exported environment variables to / from a fileWhy does this endless loop not use up my system resources?How to recover lost X windowsUnix - ps to check if script runningenvironment variables scriptMy Java environment variables seem to be a complete mess how do I make a clean start without reinstalling?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'd like to be able to know mid-working what directory a child process started in.



Here I'm in a Bash session, I start a dash session and I'd like to know where did dash start (in the example it would be /home).



$ echo $PWD
/home
$ dash
$ cd .. && echo $PWD
/ #Here I was hoping it would print /home
exit
echo $PWD
/home #And the shell somehow knew where to get back to


How do I do this?










share|improve this question







New contributor




exiting is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • This answer solves it unix.stackexchange.com/a/74253/346863 but the question isn't a duplicate.

    – exiting
    Apr 12 at 19:24











  • If you don't call cd .. first, then it would print /home.

    – ctrl-alt-delor
    Apr 12 at 19:31











  • @ctrl-alt-delor Yes, you missed my point. I start dash, I do a bunch of stuff and change directories a bunch of times, I want to know where the process as initiated.

    – exiting
    Apr 12 at 19:41






  • 2





    Add initial_pwd="$PWD" to the start. Note this is not the same as the directory containing the script.

    – ctrl-alt-delor
    Apr 12 at 19:42












  • Alas that doesn't help me because the child session I'm in always starts in the home directory, regardless of where the child started. I really need to know where the child shell initiated.

    – exiting
    Apr 12 at 19:49

















0















I'd like to be able to know mid-working what directory a child process started in.



Here I'm in a Bash session, I start a dash session and I'd like to know where did dash start (in the example it would be /home).



$ echo $PWD
/home
$ dash
$ cd .. && echo $PWD
/ #Here I was hoping it would print /home
exit
echo $PWD
/home #And the shell somehow knew where to get back to


How do I do this?










share|improve this question







New contributor




exiting is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • This answer solves it unix.stackexchange.com/a/74253/346863 but the question isn't a duplicate.

    – exiting
    Apr 12 at 19:24











  • If you don't call cd .. first, then it would print /home.

    – ctrl-alt-delor
    Apr 12 at 19:31











  • @ctrl-alt-delor Yes, you missed my point. I start dash, I do a bunch of stuff and change directories a bunch of times, I want to know where the process as initiated.

    – exiting
    Apr 12 at 19:41






  • 2





    Add initial_pwd="$PWD" to the start. Note this is not the same as the directory containing the script.

    – ctrl-alt-delor
    Apr 12 at 19:42












  • Alas that doesn't help me because the child session I'm in always starts in the home directory, regardless of where the child started. I really need to know where the child shell initiated.

    – exiting
    Apr 12 at 19:49













0












0








0








I'd like to be able to know mid-working what directory a child process started in.



Here I'm in a Bash session, I start a dash session and I'd like to know where did dash start (in the example it would be /home).



$ echo $PWD
/home
$ dash
$ cd .. && echo $PWD
/ #Here I was hoping it would print /home
exit
echo $PWD
/home #And the shell somehow knew where to get back to


How do I do this?










share|improve this question







New contributor




exiting is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I'd like to be able to know mid-working what directory a child process started in.



Here I'm in a Bash session, I start a dash session and I'd like to know where did dash start (in the example it would be /home).



$ echo $PWD
/home
$ dash
$ cd .. && echo $PWD
/ #Here I was hoping it would print /home
exit
echo $PWD
/home #And the shell somehow knew where to get back to


How do I do this?







process environment-variables






share|improve this question







New contributor




exiting is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




exiting is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




exiting is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Apr 12 at 19:19









exitingexiting

102




102




New contributor




exiting is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





exiting is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






exiting is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • This answer solves it unix.stackexchange.com/a/74253/346863 but the question isn't a duplicate.

    – exiting
    Apr 12 at 19:24











  • If you don't call cd .. first, then it would print /home.

    – ctrl-alt-delor
    Apr 12 at 19:31











  • @ctrl-alt-delor Yes, you missed my point. I start dash, I do a bunch of stuff and change directories a bunch of times, I want to know where the process as initiated.

    – exiting
    Apr 12 at 19:41






  • 2





    Add initial_pwd="$PWD" to the start. Note this is not the same as the directory containing the script.

    – ctrl-alt-delor
    Apr 12 at 19:42












  • Alas that doesn't help me because the child session I'm in always starts in the home directory, regardless of where the child started. I really need to know where the child shell initiated.

    – exiting
    Apr 12 at 19:49

















  • This answer solves it unix.stackexchange.com/a/74253/346863 but the question isn't a duplicate.

    – exiting
    Apr 12 at 19:24











  • If you don't call cd .. first, then it would print /home.

    – ctrl-alt-delor
    Apr 12 at 19:31











  • @ctrl-alt-delor Yes, you missed my point. I start dash, I do a bunch of stuff and change directories a bunch of times, I want to know where the process as initiated.

    – exiting
    Apr 12 at 19:41






  • 2





    Add initial_pwd="$PWD" to the start. Note this is not the same as the directory containing the script.

    – ctrl-alt-delor
    Apr 12 at 19:42












  • Alas that doesn't help me because the child session I'm in always starts in the home directory, regardless of where the child started. I really need to know where the child shell initiated.

    – exiting
    Apr 12 at 19:49
















This answer solves it unix.stackexchange.com/a/74253/346863 but the question isn't a duplicate.

– exiting
Apr 12 at 19:24





This answer solves it unix.stackexchange.com/a/74253/346863 but the question isn't a duplicate.

– exiting
Apr 12 at 19:24













If you don't call cd .. first, then it would print /home.

– ctrl-alt-delor
Apr 12 at 19:31





If you don't call cd .. first, then it would print /home.

– ctrl-alt-delor
Apr 12 at 19:31













@ctrl-alt-delor Yes, you missed my point. I start dash, I do a bunch of stuff and change directories a bunch of times, I want to know where the process as initiated.

– exiting
Apr 12 at 19:41





@ctrl-alt-delor Yes, you missed my point. I start dash, I do a bunch of stuff and change directories a bunch of times, I want to know where the process as initiated.

– exiting
Apr 12 at 19:41




2




2





Add initial_pwd="$PWD" to the start. Note this is not the same as the directory containing the script.

– ctrl-alt-delor
Apr 12 at 19:42






Add initial_pwd="$PWD" to the start. Note this is not the same as the directory containing the script.

– ctrl-alt-delor
Apr 12 at 19:42














Alas that doesn't help me because the child session I'm in always starts in the home directory, regardless of where the child started. I really need to know where the child shell initiated.

– exiting
Apr 12 at 19:49





Alas that doesn't help me because the child session I'm in always starts in the home directory, regardless of where the child started. I really need to know where the child shell initiated.

– exiting
Apr 12 at 19:49










0






active

oldest

votes












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






exiting is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512160%2fknowing-what-directory-a-process-started-in%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








exiting is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















exiting is a new contributor. Be nice, and check out our Code of Conduct.












exiting is a new contributor. Be nice, and check out our Code of Conduct.











exiting is a new contributor. Be nice, and check out our Code of Conduct.














Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512160%2fknowing-what-directory-a-process-started-in%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.