Create An Easy to Use Bash Script Repository Using GitHub 🌱

In this example I'll be setting up a GitHub repository to host bash files, using the GitHub URL Shortener to simplify the URLs and then running the scripts locally on a Debian based virtual machine

Create the GitHub Repository

  1. Create or log into your existing GitHub account
  2. Click the New button in the top left to create a new repository
  3. Give the repository a name > Click the Create Repository button

Creating a Sample Bash Script

  1. Open a text editor
  2. Paste the following script into a new text document

    #!/bin/bash
    echo "hello, today is $(date '+%A'). You are running me as $(whoami)."

  3. Save the file as whoami.sh
  4. Back in the browser, click the uploading an existing file link
  5. Upload the whoami.sh file and give a brief description > Click the Commit changes button
  6. Click on the newly uploaded file
  7. Click the Raw tab at the top right of the code
  8. Copy the URL for the raw code
  9. Open another browser tab and navigate to https://git.io
  10. Paste in the raw code URL from the clipboard > Click Shorten
  11. Copy the shortened URL

Executing the Sample Bash Script

  1. Launch terminal and execute the bash file from GitHub by running the following command
    curl -L PastedShortenedURL | bash