Template:Commands: Difference between revisions

imported>Samueldr
Created page with "<noinclude> {{Template}} {{DISPLAYTITLE:Template:commands}} ===Special note=== The pipe character '''cannot''' be used as is within the template, as it is a special character..."
 
DoggoBit (talk | contribs)
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<noinclude>
<includeonly>{{code|{{{1}}}|lang=shell}}</includeonly><noinclude>{{delete|It is functionally the same as {{template link|code}} with <code>shell</code> as the language parameter.}}{{Documentation}}</noinclude>
{{Template}}
{{DISPLAYTITLE:Template:commands}}
===Special note===
 
The pipe character '''cannot''' be used as is within the template, as it is a special characters for templates.
 
It can be included [https://www.mediawiki.org/wiki/Help:Magic_words#Other using the magic word <code><nowiki>{{!}}</nowiki></code>].
 
Alternatively, it is possible to instead surround the commands in <code><nowiki><nowiki></nowiki></code> tags.
 
===Usage===
 
Take care of always aligning the {{ic|$}} to the left.
 
{{bc|<nowiki>{{Commands|$ command-not-found}}</nowiki>}}
 
{{bc|<nowiki>{{Commands|
$ command-not-found
$ other-command
}}</nowiki>}}
 
===Example===
{{Commands|$ command-not-found}}
 
{{Commands|
$ command-not-found
$ other-command
}}
 
Example with wrong alignment
 
{{Commands|
$ command-not-found
$ other-command
$ final-command
}}
 
====Escaping pipe====
 
''Look at the source to see usage.''
 
{{Commands|$ cat /proc/cpuinfo {{!}} grep '^model name' {{!}} head -n1}}
 
{{Commands|<nowiki>
# Disregard useless use of cat
$ cat /proc/cpuinfo | grep '^model name' | head -n1
</nowiki>}}
 
</noinclude><includeonly><pre<noinclude></noinclude>
  style="
    background-color: #4D4D4D;
    color: #FCFCFC;
    padding: 0.4em;
    border: 1px solid #232629;
  "
>{{{code|{{{1|{{META Error}}}}}}}}</pre<noinclude></noinclude>></includeonly><noinclude><!-- The &lt;noinclude>&lt;/noinclude> hack is needed to allow wiki markup inside the pre tags; reference: http://www.gossamer-threads.com/lists/wiki/mediawiki/118688#118688 --></noinclude>