# Help passing command line output \`edit\` command

**URL:** <https://discuss.kakoune.com/t/help-passing-command-line-output-edit-command/2468>\
**Category:** Help\
**Created:** [April 15, 2024, 9:29am UTC](https://discuss.kakoune.com/t/help-passing-command-line-output-edit-command/2468 "2024-04-15T09:29:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Valery\_Kondakoff](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/valery_kondakoff/32/1451_2.png) [@Valery\_Kondakoff](https://discuss.kakoune.com/u/Valery_Kondakoff)\
**Post date:** [April 15, 2024, 9:29am UTC](https://discuss.kakoune.com/t/help-passing-command-line-output-edit-command/2468/1 "2024-04-15T09:29:05Z")

</div>

Hi!

I’m just starting my Kakoune journey and have many questions. Here is one of them: I could not pass command line output to edit command.

This line outputs currently selected file in [Broot](https://github.com/Canop/broot) to standard output: `br --conf ~/.config/broot/select.hjson`.

 ![Снимок экрана 2024-04-15 в 12.22.25](https://discuss.kakoune.com/uploads/default/original/2X/5/59bde43dfa1a750bd150a1b5e2616362a4858fc8.png)

Now I want to pass this output to Kakoube `edit` command. Here is my attempt:

```auto
define-command open_file %{
  edit %sh{br --conf ~/.config/broot/select.hjson}
}

```

Unfortunately, this opens empty file with no name, so nothing was passed to `edit`. What am I doing wrong? The file withe current date name is succsessfully created the I enter something like this:

```auto
define-command open_file %{
  edit %sh{date}
}

```

What’s the difference?  
Thank you for help!

---

<div class="post-metadata">

**Author:** ![krobelus](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/krobelus/32/616_2.png) [@krobelus](https://discuss.kakoune.com/u/krobelus)\
**Post date:** [April 15, 2024, 9:56am UTC](https://discuss.kakoune.com/t/help-passing-command-line-output-edit-command/2468/2 "2024-04-15T09:56:10Z")

</div>

Kakoune doesn’t give the terminal to its child processes.  
Similar to `nohup br --conf ~/.config/broot/select.hjson | cat`  
If that command works, then it should also work in Kakoune.

If you want to have a terminal for a sh command, consider using the `:terminal` command.

---

<div class="post-metadata">

**Author:** ![Valery\_Kondakoff](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/valery_kondakoff/32/1451_2.png) [@Valery\_Kondakoff](https://discuss.kakoune.com/u/Valery_Kondakoff)\
**Post date:** [April 15, 2024, 11:30am UTC](https://discuss.kakoune.com/t/help-passing-command-line-output-edit-command/2468/3 "2024-04-15T11:30:04Z")

</div>

Got it, thank you!

---

<div class="post-metadata">

**Author:** ![Valery\_Kondakoff](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/valery_kondakoff/32/1451_2.png) [@Valery\_Kondakoff](https://discuss.kakoune.com/u/Valery_Kondakoff)\
**Post date:** [April 15, 2024, 11:46am UTC](https://discuss.kakoune.com/t/help-passing-command-line-output-edit-command/2468/4 "2024-04-15T11:46:40Z")

</div>

Ant chance [suspend-and-resume](https://github.com/mawww/kakoune/wiki/Integrating-Other-CLI-apps) can help in this situation?

---

<div class="post-metadata">

**Author:** ![Valery\_Kondakoff](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/valery_kondakoff/32/1451_2.png) [@Valery\_Kondakoff](https://discuss.kakoune.com/u/Valery_Kondakoff)\
**Post date:** [April 15, 2024, 12:56pm UTC](https://discuss.kakoune.com/t/help-passing-command-line-output-edit-command/2468/5 "2024-04-15T12:56:14Z")

</div>

`suspend-and-resume` seems to work. Something like this:

```auto
define-command test-sar %{
  suspend-and-resume "br --conf ~/.config/broot/select.hjson" "edit <filename>"
}

```

Unfortunately I have no idea how to save the output of `br --conf ~/.config/broot/select.hjson` to some variable, to use it later with `edit`… Any help!

Thank you!

---

<div class="post-metadata">

**Author:** ![eko234](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/eko234/32/1036_2.png) [@eko234](https://discuss.kakoune.com/u/eko234)\
**Post date:** [April 15, 2024, 1:01pm UTC](https://discuss.kakoune.com/t/help-passing-command-line-output-edit-command/2468/6 "2024-04-15T13:01:19Z")

</div>

Hello, this is tricky, there are many tools like kcr or kks, which basically help you to abstract away the chore of talking to a given kakoune session, you could check those out, but basically what you would want to do is do your stuff in the shell, and pipe the output to a tool that sends a command to your kakoune session and stores something in an option, you can even use kakoune itself for this, check the --help command, you will see you can execute arbitrary commands at any given session, and kak also has a json rpc api.
