AllSupported Logo AllSupported
Home How To Linux Search
  1. Home
  2. /
  3. .sh
  4. /
  5. Get current directory of script file in shell script

Get current directory of script file in shell script

By Tech Writer • December 10, 2014 • .sh
   DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"&& pwd ) Creds: http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in

  

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"&& pwd )

Creds: http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
AllSupported

AllSupported

Expert tech support tutorials and guides for Linux, networking, and more.

Categories

  • Linux
  • How To
  • Networking

Resources

  • Search
  • RSS Feed
  • Sitemap

Legal

  • Privacy Policy
  • Terms of Use

© 2025 AllSupported. All rights reserved.