How can I get the directory where a Bash script is located from within the script itself

0 votes

How do I get the path of the directory in which a Bash script is located, inside that script?

I want to use a Bash script as a launcher for another application. I want to change the working directory to the one where the Bash script is located, so I can operate on the files in that directory, like so:

$ ./application

Jun 21 in Linux Administration by Korak
• 5,820 points
21 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Linux Administration

0 votes
0 answers

How can I convert a series of images to a PDF from the command line on linux?

I have a scanning server I wrote ...READ MORE

Apr 21 in Linux Administration by Edureka
• 13,640 points
31 views
0 votes
1 answer

How do I check if a directory exists in a Bash shell script?

To check if a directory exists in ...READ MORE

answered Jun 7 in Linux Administration by Korak
• 5,820 points
105 views
0 votes
0 answers

How can I invoke both BASH and CSH shells in a same script

In the same script, I want to ...READ MORE

Jun 21 in Linux Administration by Korak
• 5,820 points
41 views
0 votes
0 answers

How do I run a program with commandline arguments using GDB within a Bash script?

When running a program on GDB, usually, ...READ MORE

Jun 21 in Linux Administration by Korak
• 5,820 points
13 views
0 votes
0 answers

How to detect the OS from a Bash script?

I would like to keep my .bashrc and .bash_login files in ...READ MORE

Jun 21 in Linux Administration by Korak
• 5,820 points
33 views
0 votes
0 answers

How to detect the OS from a Bash script?

I would like to keep my .bashrc and .bash_login files in ...READ MORE

Jun 22 in Linux Administration by Korak
• 5,820 points
21 views
0 votes
1 answer
0 votes
1 answer

How to find the first field from a file in Bash Shell?

Hi@akhtar, You can extract text from a file. ...READ MORE

answered Oct 20, 2020 in Linux Administration by MD
• 95,360 points
332 views
0 votes
0 answers

How can I monitor the thread count of a process on linux?

I would like to monitor the number ...READ MORE

Apr 21 in Linux Administration by Edureka
• 13,640 points
37 views
0 votes
0 answers
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP