liste_man.sh
Ceci est une ancienne révision du document !
Table des matières
Script "liste_man.sh"
Ce script a pour objet de générer un fichier .txt contenant le man des commandes qui sont dans ce wiki.
Avec deux commandes
Voici un exemple avec seulement deux commandes :
#!/bin/bash # Déclaration d'un tableau contenant la liste des commandes dont on veut générer le man tab=("cat" "cd") # Afficher tous les éléments du tableau echo ${tab[@]} # Pour chaque élément dans le tableau, générer le man et l'enregistrer dans man_NOM_COMMANDE.txt for i in ${!tab[@]}; do man ${tab[i]} > man_${tab[i]}.txt; done exit 0
On lance le script pour vérifier son bon fonctionnement :
$ ls
liste_man.sh
$ ./liste_man.sh
cat ls
$ ls
liste_man.sh man_cat.txt man_ls.txt
$ head man_*
==> man_cat.txt <==
CAT(1) Commandes CAT(1)
NOM
cat - Concaténer des fichiers et les afficher sur la sortie standard
SYNOPSIS
cat [OPTION] ... [FICHIER] ...
==> man_ls.txt <==
LS(1) Commandes LS(1)
NOM
ls - Afficher le contenu de répertoires
SYNOPSIS
ls [OPTION] ... [FICHIER] ...
Pour pouvoir exécuter le script avec le raccourcis ./, il ne faut pas oublier de faire $ chmod +x liste_man.sh
Script avec toutes les commandes
#!/bin/bash # Déclaration du tableau contenant la liste des commandes tab=("apt" "aptitude" "awk" "bash" "cat" "chgrp" "chmod" "chown" "cmake" "cp" "crontab" "curl" "cut" "date" "dd" "diff" "diff3" "dig" "dir" "dirname" "dmesg" "dpkg" "egrep" "emacs" "file" "find" "free" "from" "fsck" "git" "gksudo" "gpg" "gpg2" "grep" "gunzip" "gzip" "head" "hexdump" "history" "host" "hostname" "htop" "htpasswd" "ifdown" "ifup" "ip" "iptables" "irssi" "isodump" "journalctl" "kvm" "latex" "less" "line" "link" "locate" "logname" "ls" "lscpu" "lshw" "lsof" "lspci" "lsusb" "lynx" "make" "man" "minicom" "mlocate" "modprobe" "mogrify" "more" "most" "mount" "mutt" "nano" "nc" "ncat" "netcat" "nl" "nmap" "nohup" "nslookup" "open" "openssl" "pager" "pdfinfo" "pdflatex" "pftp" "photorec" "pico" "print" "proxy" "ps" "pulseaudio" "pwd" "python" "qpdf" "quickbook" "ranger" "rename" "resize" "rm" "rmdir" "route" "rsync" "rvim" "scp" "screendump" "script" "sdiff" "seahorse" "sed" "see" "sftp" "size" "sleep" "snice" "sort" "split" "ssh" "sshfs" "startx" "su" "sudo" "systemd" "tar" "tee" "telnet" "top" "touch" "tracepath" "tree" "umount" "unar" "uncompress" "uniq" "unrar" "unzip" "uptime" "users" "vi" "vim" "volname" "w" "wait" "wc" "weave" "wget" "whatis" "whereis" "which" "whiptail" "who" "whoami" "whois" "wish" "write" "xrandr" "yes" "ypdomainname" "zcat" "zcmp" "zip") # Afficher tous les éléments de "tableau" echo ${tab[@]} # Exporter le man de chaque commande for i in ${!tab[@]}; do man ${tab[i]} > man_${tab[i]}.txt; done exit 0
Exécution
$ ls liste_man.sh $ ./liste_man.sh apt aptitude awk bash cat chgrp chmod chown cmake cp crontab curl cut date dd diff diff3 dig dir dirname dmesg dpkg egrep emacs file find free from fsck git gksudo gpg gpg2 grep gunzip gzip head hexdump history host hostname htop htpasswd ifdown ifup ip iptables irssi isodump journalctl kvm latex less line link locate logname ls lscpu lshw lsof lspci lsusb lynx make man minicom mlocate modprobe mogrify more most mount mutt nano nc ncat netcat nl nmap nohup nslookup open openssl pager pdfinfo pdflatex pftp photorec pico print proxy ps pulseaudio pwd python qpdf quickbook ranger rename resize rm rmdir route rsync rvim scp screendump script sdiff seahorse sed see sftp size sleep snice sort split ssh sshfs startx su sudo systemd tar tee telnet top touch tracepath tree umount unar uncompress uniq unrar unzip uptime users vi vim volname w wait wc weave wget whatis whereis which whiptail who whoami whois wish write xrandr yes ypdomainname zcat zcmp zip man: impossible d'ouvrir /usr/share/man/man3/caca_event_@0.3caca: Aucun fichier ou dossier de ce type mdoc warning: Empty input line #226 mdoc warning: Empty input line #228 mdoc warning: Empty input line #251 mdoc warning: Empty input line #253 mdoc warning: Empty input line #255 mdoc warning: Empty input line #482 mdoc warning: Empty input line #484 mdoc warning: Empty input line #547 man: impossible d'ouvrir /usr/share/man/man3/caca_event_@0_@2.3caca: Aucun fichier ou dossier de ce type $ ls liste_man.sh man_egrep.txt man_irssi.txt man_more.txt man_python.txt man_ssh.txt man_wait.txt man_alias.txt man_emacs.txt man_isodump.txt man_most.txt man_qpdf.txt man_startx.txt man_wc.txt man_aptitude.txt man_file.txt man_journalctl.txt man_mount.txt man_quickbook.txt man_sudo.txt man_weave.txt man_apt.txt man_find.txt man_jrnl.txt man_mutt.txt man_ranger.txt man_su.txt man_wget.txt man_awk.txt man_free.txt man_kvmq.txt man_nano.txt man_rename.txt man_systemd.txt man_whatis.txt man_bash.txt man_from.txt man_latex.txt man_ncat.txt man_resize.txt man_tar.txt man_whereis.txt man_cat.txt man_fsck.txt man_less.txt man_nc.txt man_rmdir.txt man_tee.txt man_which.txt man_cd.txt man_git.txt man_let.txt man_netcat.txt man_rm.txt man_telnet.txt man_while.txt man_chgrp.txt man_gksudo.txt man_line.txt man_nl.txt man_route.txt man_top.txt man_whiptail.txt man_chmod.txt man_gpg2.txt man_link.txt man_nmap.txt man_rsync.txt man_touch.txt man_whoami.txt man_chown.txt man_gpg.txt man_locate.txt man_nohup.txt man_rvim.txt man_tracepath.txt man_whois.txt man_cmake.txt man_grep.txt man_logname.txt man_nslookup.txt man_scp.txt man_tree.txt man_who.txt man_cp.txt man_gunzip.txt man_lscpu.txt man_openssl.txt man_screendump.txt man_umount.txt man_wish.txt man_crontab.txt man_gzip.txt man_lshw.txt man_open.txt man_script.txt man_unalias.txt man_write.txt man_curl.txt man_head.txt man_lsof.txt man_pager.txt man_sdiff.txt man_unar.txt man_w.txt man_cut.txt man_hexdump.txt man_lspci.txt man_pdfinfo.txt man_seahorse.txt man_uncompress.txt man_xrandr.txt man_date.txt man_history.txt man_ls.txt man_pdflatex.txt man_sed.txt man_uniq.txt man_yes.txt man_dd.txt man_hostname.txt man_lsusb.txt man_pftp.txt man_see.txt man_unrar.txt man_ypdomainname.txt man_diff3.txt man_host.txt man_lynx.txt man_photorec.txt man_sftp.txt man_until.txt man_zcat.txt man_diff.txt man_htop.txt man_make.txt man_pico.txt man_size.txt man_unzip.txt man_zcmp.txt man_dig.txt man_htpasswd.txt man_man.txt man_print.txt man_sleep.txt man_uptime.txt man_zip.txt man_dirname.txt man_ifdown.txt man_minicom.txt man_proxy.txt man_snice.txt man_users.txt man_dir.txt man_ifup.txt man_mlocate.txt man_ps.txt man_sort.txt man_vim.txt man_dmesg.txt man_iptables.txt man_modprobe.txt man_pulseaudio.txt man_split.txt man_vi.txt man_dpkg.txt man_ip.txt man_mogrify.txt man_pwd.txt man_sshfs.txt man_volname.txt
Je ne sais pas exactement d'où viennent les erreurs à l'exécution…
liste_man.sh.1450742836.txt.gz · Dernière modification : (modification externe)
