DEV Community

Cover image for Bash Better: How I Built a Tool to Organize Scripts Effectively
Patrick
Patrick

Posted on

Bash Better: How I Built a Tool to Organize Scripts Effectively

Introduction

Before I delve into discussing my script "Link-It," allow me to introduce myself briefly: My name is Patrick, and I've been working as a software developer, software architect, and project manager for over a decade.

I've been involved in various client projects (custom developments) and have always strived to automate repetitive tasks or write small scripts to accomplish specific tasks quickly and efficiently.

The Inspiration Behind My Project

As I mentioned earlier, I have various scripts for different tasks. Some of these scripts I use daily, some weekly, and others only 1-2 times a month.

Each of these scripts resides in its own folder and is versioned in Git.

Now, it's not very user-friendly to always know where the script I currently need is located.

It would be much simpler if all my scripts were on the PATH, allowing me to execute them anywhere.

That's how I came up with the idea to create "Link-It." A small script that links the scripts to a folder that is on the PATH.

How Link-It Works

Link-It is a simple script designed to streamline the process of managing and accessing your scripts. It automates the following tasks:

  • It creates the folder .local/bin in your HOME directory if it doesn't already exist.
  • It adds the newly created folder to your PATH if it's not already included.
  • It creates a symlink to the specified file in the .local/bin folder.
  • For user convenience, when creating the symlink, Link-It removes the file extension.
    • For example, my-super-script.sh would be linked as my-super-script.

Link-It is an open-source project hosted on GitHub

Feel free to explore the repository, contribute to the project, or provide feedback.

How Link-It Can Simplify Your Workflow

If I'm now writing a new script that simplifies a process for a client project, I no longer have to remember the path to that script. Instead, I simply execute link-it /path/to/my/new/script.sh, and from then on, I can use my script anywhere.

Conclusion

That concludes the introduction to my little script, "Link-It." I would greatly appreciate your feedback on this post, my README on GitHub, and the project in general.

Perhaps this project is also of interest to others. I'm open to expanding it to cover your specific use cases as well. Your input and contributions would be invaluable in shaping the future development of Link-It.

My Call to the Community

Do you have your own little scripts that help you in your daily life?
Do you also enjoy writing small automations?

I would be thrilled to exchange scripts and ideas with you. I'm eager to learn from other scripts and experiences. Feel free to leave a comment and let's start the conversation!

Community

Top comments (0)