Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explain the last dash in a bash/pipe expression

Tags:

bash

pipe

I am trying to understand a bash expression

oc process -f build/my-build-template.yaml  GITSERVER=$GITSERVER | oc create -f - 

found here: https://github.com/openshift/origin/issues/15474

This is an example from the OpenSift API. The first part oc process -f build/my-build-template.yaml GITSERVER=$GITSERVER returns some JSON:

I understand, that this JSON will be the input for the oc create -f <EXPECT FILE AS INPUT HERE> which expects a file.

What is the purpose of the last - in the ... | oc create -f -

like image 713
Skip Avatar asked Sep 15 '17 11:09

Skip


1 Answers

Many tools allow specification of standard input as a filename of "-". This allows the pipe to work as expected without requiring a shell- or OS-based workaround.

like image 190
Ignacio Vazquez-Abrams Avatar answered Oct 29 '22 04:10

Ignacio Vazquez-Abrams