[GH-ISSUE #10293] Save the question, too. #32518

Closed
opened 2026-04-22 13:52:00 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @grafl on GitHub (Apr 16, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/10293

Hi Ollama Team,

I am often in a situation where I need to save (redirect) an answer to a file and close the command line. In such cases, it would be nice if the answer would start with the question itself. Is it possible to enable this with a command line option, like -q?

Example:

ollama -q run qwen2.5-coder:7b "Et ubi nunc deinde, Ollama?' >> ollama_answer.md

Q
Et ubi nunc deinde, Ollama?

A
Ascendite ad cacumen mundi!

Best regards,
László

Originally created by @grafl on GitHub (Apr 16, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/10293 Hi Ollama Team, I am often in a situation where I need to save (redirect) an answer to a file and close the command line. In such cases, it would be nice if the answer would start with the question itself. Is it possible to enable this with a command line option, like **-q**? Example: `ollama -q run qwen2.5-coder:7b "Et ubi nunc deinde, Ollama?' >> ollama_answer.md` `Q` `Et ubi nunc deinde, Ollama?` `A` `Ascendite ad cacumen mundi!` Best regards, László
GiteaMirror added the feature request label 2026-04-22 13:52:00 -05:00
Author
Owner

@Abubakkar13 commented on GitHub (Apr 16, 2025):

Hey,

I was just playing around with it for a while to make the workflow smoother.

Try like this Bash function idea for reuse

If you are the bash user, then edit(just add into it):

nano ~/.bashrc

Add below code at the end of that file:

ollamawf () {
  (
    echo -e "Q\n$1\n\nA"
    ollama run "$2" "$1"
  ) >> ollama_answer.md
}

Then reload the shell:

source ~/.bashrc

Then use it like:

ollamawf "Et ubi nunc deinde, Ollama?" qwen2.5-coder:7b

Finally check in cwd, you will find .md file

Regards
Abubakkar

<!-- gh-comment-id:2808663373 --> @Abubakkar13 commented on GitHub (Apr 16, 2025): Hey, I was just playing around with it for a while to make the workflow smoother. Try like this Bash function idea for reuse If you are the bash user, then edit(just add into it): `nano ~/.bashrc` Add below code at the end of that file: ``` ollamawf () { ( echo -e "Q\n$1\n\nA" ollama run "$2" "$1" ) >> ollama_answer.md } ``` Then reload the shell: `source ~/.bashrc` Then use it like: `ollamawf "Et ubi nunc deinde, Ollama?" qwen2.5-coder:7b` Finally check in cwd, you will find .md file _Regards Abubakkar_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#32518