The two questions should be compared, at least, based on their titles as well as their answers. That the answer to this question is already covered by another is, or should be, irrelevant. KennyEvitt actually, one of the main reasons we close is precisely because an answer has been given elsewhere. And, in fact, the main question here is actually how to assign the output of a command to a variable, which is covered by the dupe.
I have also given the answer to this specific case, so all bases are covered. There would be no benefit in opening this again. If anything, I think this question should be edited to more closely match its title and it should be re-opened, not to allow further activity, but to not imply that this question is 'bad'. KennyEvitt closing as a duplicate in no way implies that the question is bad! This question will remain here, answered, for ever.
If you really want to know how to get the current working directory, you will find your answer here. If you just want to know how to save the output of a command in a variable, you will also find the answer here by following the link to the dupe.
Add a comment. Active Oldest Votes. Below is a snippet that will print the PWD and the installed directory:! Can you explain what's going on? When my script gets run more than 20 times simultaneously, I get the following error To print the current working Directory i.
Sachin Java Sachin Java 29 1 1 bronze badge. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The Overflow Blog. Stack Gives Back Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked Related 3. Hot Network Questions. Quick solution:! Screenshot: Currently executed script directory path in Bash.
Donate to Dirask. Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Direct link. Bash Bash - add user to exiting group in Linux. Bash - batch export from svg to properly sized png file. Bash - calculate md5 sum in terminal. Bash - check array size.
Bash - check file data. Bash - check if command is supported. Bash - check if file exists. Bash - check if string is empty. Bash - check tomcat version. Bash - command alias. Bash - compress files with tar command in Linux. Bash - compress svg file.
0コメント