How to use [cmd] tags

wblock@

Developer
[cmd] tags are used to show a command line:
# ls -lh /etc

The opening tag takes a parameter that is the prompt, usually # for root, or $ or % for a normal user. The example above can be entered by typing this:
[cmd="#"]ls -lh /etc[/cmd]

To format a line already entered as a command, drag-select it with the mouse or keyboard and click the [cmd] button. When asked Please enter the option for your [CMD] tag:, enter the single prompt character.

For proper formatting, do not use more than a single character for the prompt.
 
The parameter for the [cmd] tag is not restricted to a single character, you can use multiple chars if you type the tags manually.
This:

[code][cmd=root@j65nko:/root # ]ls -ol /sbin/init[/cmd]
-r-xr-xr-x 1 root wheel schg 791384 Dec 4 10:33 /sbin/init[/code]

will become:

Code:
[cmd=root@j65nko:/root # ]ls -ol /sbin/init[/cmd]
-r-xr-xr-x  1 root  wheel  schg 791384 Dec  4 10:33 /sbin/init
 
That is right. Care should be taken not to put an actual command in there though. This may simply vanish or show up double.
 
It doesn't really matter if you use [cmd=#]ls[/cmd] or just type [cmd]# ls[/cmd]

In HTML, it does:
Code:
<samp>#</samp> <kbd>ls</kbd>

From the HTML spec:
SAMP: Designates sample output from programs, scripts, etc.
KBD: Indicates text to be entered by the user.

So from a semantic point of view it matters. Has it actually ever helped anyone? I doubt it.
 
I see (and catch / fix) a lot of [cmd=ls]ls[/cmd] and [cmd]ls[/cmd] type errors, which give sub-optimal results ;)
 
Those errors are probably due to the very poorly-worded question the mouse version asks: Please enter the option for your tag:[/file].

Can we change that to ask [file]Please enter the prompt for this command:[/file]?
 
This does not appear to be determined by the administration panel. It is the default prompt for any forum tag that has the option to have an .. option. Like cmd.
 
Back
Top