Skip to content
Jassweb
  • Home
  • Company
    • About Us
    • Portfolio
    • Blog
    • CareerĀ 
  • Services
    • SEO
    • Digital Marketing
    • Web Design & Development
    • E-commerce Solutions
    • Fix Broken Website
    • Website Maintenance
    • Web Hosting & Manage Server
    • Enterprise Automation Solutions
    • Full-Stack SaaS Development
    • Coolify Automation Plugin
  • Shop
  • Tools
  • My Account
    • Cart
    • Checkout
    • My Bookings
      • Appointment canceled
      • Appointment reschedule
  • Contact Us

Bash Shell

How to Get Directory Where Bash Script is Located From Within the Script

April 10, 2023 by Jass Web

You can use the `$0` variable to get the directory where the bash script is located from within the script. For example, if the script is located in `/home/user/scripts/myscript.sh`, you can use the following command to get the directory: “` DIR=”$( cd “$( dirname “$0″ )” >/dev/null 2>&1 && pwd )” “` This will set … Read more

Categories Bash Shell, Linux, Tutorials
Newer posts
← Previous Page1 Page2
© 2026 Jassweb • Built with GeneratePress