Skip to main content

Bard-Shell: Introduction

<time datetime="2023-07-24 18:47:17 &#43;0530 IST">24 July 2023</time><span class="px-2 text-primary-500">&middot;</span><span>579 words</span><span class="px-2 text-primary-500">&middot;</span><span title="Reading time">3 mins</span><span class="px-2 text-primary-500">&middot;</span> <span class="mb-[2px]"> <a href="#/blog/Bard-Shell/introduction.md" class="text-lg hover:text-primary-500" rel="noopener noreferrer" target="_blank" title="Edit content" ><span class="relative inline-block align-text-bottom px-1 icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M490.3 40.4C512.2 62.27 512.2 97.73 490.3 119.6L460.3 149.7L362.3 51.72L392.4 21.66C414.3-.2135 449.7-.2135 471.6 21.66L490.3 40.4zM172.4 241.7L339.7 74.34L437.7 172.3L270.3 339.6C264.2 345.8 256.7 350.4 248.4 353.2L159.6 382.8C150.1 385.6 141.5 383.4 135 376.1C128.6 370.5 126.4 361 129.2 352.4L158.8 263.6C161.6 255.3 166.2 247.8 172.4 241.7V241.7zM192 63.1C209.7 63.1 224 78.33 224 95.1C224 113.7 209.7 127.1 192 127.1H96C78.33 127.1 64 142.3 64 159.1V416C64 433.7 78.33 448 96 448H352C369.7 448 384 433.7 384 416V319.1C384 302.3 398.3 287.1 416 287.1C433.7 287.1 448 302.3 448 319.1V416C448 469 405 512 352 512H96C42.98 512 0 469 0 416V159.1C0 106.1 42.98 63.1 96 63.1H192z"/></svg> </span></a > </span>

Bard-Shell: A Tool for Sending Linux Command Outputs to Bard.

Introduction #

I recently created a software called Bard-Shell, which allows me to send the output of Linux commands to Bard for debugging and other purposes. Bard-Shell is a simple Python script that takes a Linux command as input and pipes the output to Bard.

Usage and Examples #

The Usage instructions are provided on the github page.

Setup an alias for bard in .zshrc which points to bard-shell.py

Simple use #

To send the output of the ls command to Bard, I would type the following command using the -p flag to pass in a prompt about the thing i would like to do:

ls | bard -p "Summarize the contents of this folder"

Bard-Shell will then send the output of the ls command to Bard, where I can use it for anything.

For Debugging #

You can pass errors into bard and ask it to resolve the issue you are facing For Example, passing in the status of lightdm to resolve some error

systemctl status lightdm | bard -p "Suggest Solutions to any error found in this command output" 

You can also pass in these flags to provide Bard with extra information.

  1. -i or --send-sysinfo - To send system information (Using neofetch right now)
  2. -w or --send-pwd - To send present working directory

Some users consider this to be a privacy hazard, so it is opt in

Writing Code #

Bard-Shell supports a variety of options when generating code from bard Using the -m flag to specify you need only the code, brings up an options menu

bard -p "Write a shell script to remind me to drink water every 10 minutes" -m code

The menu is as follows:

# Generated code here
[E]dit,[R]un,[W]rite,[A]bort:

The menu allows you to:

  • Edit the generated code
  • Write it to any file
  • Run the code directly (Only works on bash scripts right now)

For Fun #

You can use bard-shell without passing any command output as normal Bard in the shell

bard -p "Write a Rick and morty conversation on the growing power of AI"

Some insight #

I created Bard-Shell because I often find myself needing to debug Linux commands. In the past, I would have to copy and paste the output of the command into a text editor, then send it to Bard. (Or Just search for hours on the internet) This was a tedious process, and it was easy to make mistakes.

Bard-Shell makes it much easier to debug Linux commands. I can simply type the command and Bard-Shell will send the output to Bard for me. This is a much faster and more efficient process.

Future Scope #

I am still working on improving Bard-Shell. In the future, I plan to add the following features:

  • The ability to send the output of multiple commands to Bard at once.
  • The ability to save the output of commands to a file.
  • The ability to filter the output of commands.

I believe that Bard-Shell is a useful productivity tool for anyone. It makes it easy to debug Linux commands and to share the output of commands with others.

Conclusion #

Bard-Shell is a simple but useful tool for productivity, and helps you find information quickly and efficiently using the amazing power of AI.

In fact, this blog was generated by Bard-Shell, I made some changes to it by adding more Examples and stuff

Have a good one!

Repo : https://github.com/kshitijaucharmal/Bard-Shell