Fun with GitHub Copilot #2 (Shell Scripting)

Shell Scripting commands in *nix environments

Michael D. Callaghan
ngconf
Published in
7 min readOct 7, 2022

--

AI programmer looking at web code — Image from Pixabay.com
Image by Gerd Altmann on Pixabay

Note: This article is an except from my book, P-AI-R Programming: How Al tools like GitHub Copilot and ChatGPT Can Radically Transform Your Development Workflow.

After my last experiment with GitHub Copilot and RxJS, I started wondering how it would do with shell scripting. A while back I wrote an article I called “What the ~|&||&&$!`()?,” mostly about what those symbols mean in a bash (or similar) shell and how to use them.

Can GitHub Copilot give me these types of commands from nothing but comments? Read on to find out.

#!/bin/bash

The first thing I did was to create a blank file in VS Code. At the top of the file, I added a “shebang” line to indicate that the file contains shell scripting code.

#!/bin/bash

Next, I added the following comment to see what Copilot would write for me.

# Check for a directory and print a message if it doesn't exist

--

--