X
X
xozzslip2017-01-30 20:24:06
linux
xozzslip, 2017-01-30 20:24:06

What's the best way to pass a string to a command line utility that requires a file?

The input utility requires a file. But I have a string at my disposal.
Are there better approaches to the problem than:

  1. create a temporary file (mktemp for example)
  2. write a string to it
  3. transfer file to utility
  4. delete a file

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Chudnovsky, 2017-01-30
@xozzslip

Pass "-" as the file name. This is a standard input-output file into which you can push your line through, for example, echo "string" |

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question