mycli icon indicating copy to clipboard operation
mycli copied to clipboard

Is it possible to capture the output of a shell command?

Open your-diary opened this issue 1 month ago • 1 comments

If I understand correctly, that is not possible in the official mysql command.

But does mycli perhaps have that feature (given that mycli implements many shell-related extensions such as $| and $>)?

What I want is like this though I'm not particular about the actual syntax:

-- The command is executed in shell and its stdout is captured/returned.
-- The entire statement is aborted when the command exits with non-zero status.
SET @my_id = CAPTURE_OUTPUT("my_id_generator --short");

INSERT INTO user (id) VALUES (@my_id);

your-diary avatar Nov 10 '25 02:11 your-diary

Neat idea! But we don't have such a feature, only trailing processing of queries.

rolandwalker avatar Nov 10 '25 10:11 rolandwalker