User Tools

Site Tools


shell_or_bash_scripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
shell_or_bash_scripts [2017/05/28 11:49] skipidarshell_or_bash_scripts [2022/10/14 06:01] (current) – [Double-Dash in Shell commands] skipidar
Line 120: Line 120:
  
  
 +==== Input from command line ====
 +If a command expects **a file** as input - one can pass input from STDOUT instead,
 +without storing the output to a file first by using following syntax
 +
 +**oc create -f** expects a file here.
 +
 +<code>
 +oc process -f build/my-build-template.yaml  GITSERVER=$GITSERVER | oc create -f - 
 +oc process -f build/my-build-template.yaml  GITSERVER=$GITSERVER | oc create -f /dev/stdin 
 +</code>
 +
 +
 +==== Double-Dash -- in Shell commands ====
 +A double-dash in a shell command signals the end of options and disables further option processing.
 +https://www.baeldung.com/linux/double-dash-in-shell-commands
 +
 +
 +<sxh shell>
 +# If we use the same approach, we'll receive an error:
 +# That's because grep treats "--hello" as a multi-character command option.
 +grep "--hello" data.txt
 +
 +#works
 +grep -- --hello data.txt
 +</sxh>
shell_or_bash_scripts.1495972140.txt.gz · Last modified: (external edit)