help : cde shell

Pàgina inicial

Reply to this message
Autor: anne aublanc
Data:  
A: guilde
Assumpte: help : cde shell
bonjour,

Jamais vu des pgms shell comme cela ;o))

S'il y a des pros du shell, j'aimerai bien leur envoyer la chose en tgz...
qu'il me dise si c'est courant des pgms comme ceux-là!
Ce n'est pas gros du tout... le plus gros fait 1 page 1/2, le + petit
quelques lignes...avec plein de commentaires!

J'ai trouvé plein de choses que je ne connaissais pas!
Comme la cde basename, ou que l'on pouvait mettre des fonctions dans un
script shell!


J'ai des doutes sur certaines choses....

Mon pb $match est toujours à 0....
J'ai l'impression que le cut ne fonctionne pas très bien

1er pgm : un extrait qui me pose problème
match=0                         # no section matches yet
name=""                         # no name for id yet
cat $config | while read line   # read config line by line
do
        command=`echo $line | cut -d" " -f1 -s` # extract command
        data=`echo $line | cut -d" " -f2- -s`   # extract parameter


        if [ "$command" = "" ]                  # empty line
        then
                command=$line
        fi
        case "$command" in
        "#"*)                                   # comment - ignore
                ;;
        "")                                     # end of section
                if [ $match -ne 0 ]
                then
                        exit 0                  # section done, exit
                fi
                ;;
        "id")                                   # id of caller
                if [ $data = "" ]
                then
                        if [ $match -eq 0 ]
                        then
                                log "default section"
                                match=1
                        fi
                fi
                if [ -z "$name" ]
                then
                         if [ `echo $id | grep "$data" | wc -l` -gt 0 ]
                        then
                                log "id $id matches section $data"
                                match=1
                        fi
                fi
                ;;
        "name")                                 # name of caller
                if [ "$match" -ne 0 ]
                then
                        if [ -z "$name" ]
                        then
                                name=$data
                                log "name of $id is $name"
                        fi
                fi
                ;;
        *)
                #type -type $command >>$log
                if [ "$match" -ne 0 ]
                then
                    log " cde1 : $command $*"
                    $command $* >>$log 2>&1
                    $home/$command.module $* >>$log 2>&1
                fi
                ;;
        esac
done



le fichire qu'il lit pour extraire :
# This is the default. Two named and all others
id 49601
name Andrea Brunsch
id 5075436
name Georg Stojkov
id 304478
name FileNet GmbH
id
write dekay root
mail dekay@???
archive

si vous pouvez m'aider...

anne