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;
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
New contributor
|
show 6 more comments
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
New contributor
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 callcd ..
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
Addinitial_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
|
show 6 more comments
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
New contributor
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
process environment-variables
New contributor
New contributor
New contributor
asked Apr 12 at 19:19
exitingexiting
102
102
New contributor
New contributor
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 callcd ..
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
Addinitial_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
|
show 6 more comments
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 callcd ..
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
Addinitial_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
|
show 6 more comments
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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