2

This question already has an answer here:

<() doesn't seem to do what I expect.

This command requires a text file (it's JLinkExe, the text file contains commands for JLinkExe to run. But that shouldn't matter).

JLinkExe -CommanderScript <scriptfile>

I need to create the files dynamically, since their content depend on what I'm currently trying to achieve.

My current solution is to create a temporary file, fill it with content with printf, then call the JLinkExe command with that temporary file.

I have a feeling that this should be achievable with <(), but I don't succeed.

This doesn't work:

JLinkExe -CommanderScript <(printf "ShowEmuList\nexit\n")

I was expecting <() to create a temporary file descriptor, with the content of the file being the string. It works with cat, but JLinkExe complains the it cannot read the command file.

Am I wrong, or is it just that JLinkExe is stupid (it doesn't take stdin)?

marked as duplicate by schily, Thomas, Jeff Schaller, roaima, Toby Speight Sep 6 '18 at 14:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    From their wiki it appears it needs a file: -CommanderScript <ScriptPath> Selects a J-Link Commander Command file which contains the commands for the batch mode. – Mr Shunz Sep 6 '18 at 8:04
  • 2
    Maybe JLinkExe expects the file to be seekable? – Kamil Maciorowski Sep 6 '18 at 8:04
  • @MrShunz: so <() doesn't fake a file? I thought that's what it did, and that the application wouldn't be able to tell. – Gauthier Sep 6 '18 at 8:18
  • @Gauthier looks like Kamil is right. Probably JLinkExe needs the file to be seekable. – Mr Shunz Sep 6 '18 at 8:45
  • Thanks, that makes sense! And I guess zsh's =() would make it, but I don't want to require zsh. – Gauthier Sep 6 '18 at 8:49