Arnaud JAYET a écrit :

Bonjour,

en espérant pas etre HS vu que c'est plus une question programmation Linux que purement Debian.

je souhaite ecrire un script bash utilisant des flags avec des noms longs genre :

$ ./monscript  --user=toto --group=tutu

Salut,

me répond à moi-meme, si cela peut servir à d'autres....


utiliser getopt -o <optstring> -l <opstring>

et puis lire, relire et re-relire le man ;-) car

man getopt

EXAMPLES
Example scripts for (ba)sh and (t)csh are provided with the getopt(1) distribution, and are optionally installed in /usr/lib/getopt or /usr/local/lib/getopt (if you have created it).

juste que c'est pas dans /usr/lib/getopt mais dans /usr/share-doc/util-linux/examples (paquet util-linux)

$ ls /usr/share/doc/util-linux/examples/
fstab.example2.gz     getopt-parse.tcsh.gz  getopt-test.tcsh.gz
getopt-parse.bash.gz  getopt-test.bash.gz   sfdisk.examples.gz

$ zcat getopt-parse.bash.gz

un beau script d'exemples , ouin.....

A+
Arnaud



--
Pensez à lire la FAQ de la liste avant de poser une question :
http://wiki.debian.net/?DebianFrench

Pensez à rajouter le mot ``spam'' dans vos champs "From" et "Reply-To:"

To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Répondre à