Generate and run Bash commands using OpenAI’s GPT models.
- Bash (any linux based system)
 - curl
 - jq
 - OpenAI API key
 
curl -fsSL https://raw.githubusercontent.com/zmsp/ask-bash/main/ask -o /tmp/ask
chmod +x /tmp/ask
sudo mv /tmp/ask /usr/local/bin/
ask --helpGenerate a bash command for a task and optionally run it:
ask your task descriptionSend a direct question or prompt to the API (skips “run this command” behavior with - flag):
ask -q Explain the ls command optionsSet your API key by exporting OPENAI_API_KEY or let the script prompt and save it.
ask --help- 
OPENAI_API_KEY— your OpenAI key (required). You can either:- 
Export it in your current shell:
export OPENAI_API_KEY="your_api_key_here"
 - 
Or run the script once and it will prompt you to paste the key and save it securely to
~/.openai_api_key. 
 - 
 - 
VERBOSE=true— enable debug output (optional) 
MIT © Zobair
