0

I have my own symfony console commands, some of which take a filename as the argument.

eg. $ php app/console mycommands:doTheThing /path/to/my/file.txt

I have tried using the /dev/fd/0 trick to use a string instead of a file here, however it's still not working.

eg. $ php app/console mycommands:doTheThing php://dev/fd/0 <<<'myFileContents'

Could anybody provide any insight or help?

Community
  • 1
  • 1
Brian Brownton
  • 1,313
  • 14
  • 31

1 Answers1

0

You can use process substitution:

$ php app/console mycommands:doTheThing <(echo "foobar")
solarc
  • 5,638
  • 2
  • 40
  • 51
  • I get `Exception Message: Warning: fopen(/dev/fd/63): failed to open stream: No such file or directory` and then a reference to the line number of the `fopen`. – Brian Brownton Dec 06 '16 at 18:55