bashgpt relies on OpenAI's ChatGPT API, so you will need an account there (not ChatGPT+, but one that gives you access to the API). OpenAI gives you some free token budget when you sign up. Once it's exhausted, the price is $0.002 for 1k tokens, as of 03/12/2023. bashgpt is limited to 512 tokens per script, and shorter scripts consume much less.
- Install dotnet 7.0+
- Clone this repository:
git clone https://github.com/dtegunov/bashgpt
- Inside the bashgpt directory, build:
dotnet publish /p:PublishProfile=FolderProfile --configuration Release
- Add the bin directory to your PATH:
export PATH=$PATH:/path/to/bashgpt/bin
(add this line to ~/.bashrc to have it included every time you open a new terminal) - Save your OpenAI API key in ~/openai.key
- The manual editing functionality requires
nano
to be installed
Just type bashgpt
, followed by your request, and press enter. Once a script is generated, you can run it, edit manually or with ChatGPT's help, save, or cancel. When you save the script, a fitting name is auto-suggested by ChatGPT.