Including a command within the wiki

De Wiki de Calcul Québec
Aller à : Navigation, rechercher
Cette page est une traduction de la page Inclure une commande dans le wiki et la traduction est complétée à 100 % et à jour.

Autres langues :anglais 100% • ‎français 100%

To include a command within the wiki, you should use the {{Commande}} template. This template detects the bash syntax. For example, the code

{{Commande|cd src; make && make install; cd ..}}

results in:

[nom@serveur $] cd src; make && make install; cd ..


Sommaire

Including a "=" within a command

Since {{Commande}} is a template, the "=" signs are interpreted by the wiki. To include an equality sign, use the meta-template {{=}}. For example, the code:

{{Commande|./configure --prefix{{=}}$HOME && make && make install}}

results in:

[nom@serveur $] ./configure --prefix=$HOME && make && make install


Including a set of commands

You can use the {{Commands}} template to include a set of commands. You may then write each command on a separate line, and prepend the | character in front of each command. For example, the code

{{Commands
|cd src
|make
|make install
|cd ..
}}

results in:

 
 [name@server $] cd src
 [name@server $] make
 [name@server $] make install
 [name@server $] cd ..
 


Modifying the command prompt

If you want to modify the command prompt, you may do it by including a prompt argument to the template. For example,

{{Command|prompt=[name@briaree ~]|cd src; make && make install; cd ..}}

results in

[name@briaree ~] cd src; make && make install; cd ..


In the same way,

{{Commands
|prompt=[name@briaree $]
|cd src
|make
|make install
|cd ..
}}

results in

 
 [name@briaree $] cd src
 [name@briaree $] make
 [name@briaree $] make install
 [name@briaree $] cd ..
 


Displaying the result of a command

You can display the result of a command (and only one) by adding the option result. For example,

{{Command
|df -h .
|result=
Sys. de fich.         Tail. Occ. Disp. %Occ. Monté sur
/lustre2/home         516T  340T  150T  70% /home
}}

results in :

[name@server $] df -h .
 Sys. de fich.         Tail. Occ. Disp. %Occ. Monté sur
/lustre2/home         516T  340T  150T  70% /home


Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Ressources de Calcul Québec
Outils
Partager