diff options
author | Kévin Raymond <shaiton@fedoraproject.org> | 2011-12-16 23:17:29 (GMT) |
---|---|---|
committer | Kévin Raymond <shaiton@fedoraproject.org> | 2011-12-16 23:17:29 (GMT) |
commit | 07e05fc08353b1bd11df3ea983fe3c879d824e0e (patch) | |
tree | e5adc30226ceb57364805f7cfe9a306548e0bead | |
parent | 24af0e5b403ccf23dbeff790a21946758a83ec77 (diff) |
should work soonbroken
-rwxr-xr-x | jparser | 25 |
1 files changed, 8 insertions, 17 deletions
@@ -76,18 +76,9 @@ get_sed() # parse filename output name output_format # -par() -{ - - echo $* - echo "WHOLE=$WHOLE=BASIC=$BASIC=X=$CHILD=SOURCE=$SOURCE=DEST=$DEST" - exit 0 - -} - parse() { - tmp=$(sed -e 's/": ["]/:/g;s/["], "/#/g;s/^{"//g;s/: ""}//g;s/": /:/g;s/, "/#/g;s/"}//g' $1) + tmp=$(sed -e 's/": ["]/:/g;s/["], "/#/g;s/^{"//g;s/: ""}//g;s/": /:/g;s/, "/#/g;s/"}//g' $SOURCE) IFS='#' read -ra ADDR <<< "$tmp" for i in "${ADDR[@]}"; do @@ -104,13 +95,13 @@ parse() esac done - if [ -z $BASIC ] + if [ ! -z $BASIC ] then - echo `date -d @${timestamp} +%d/%m/%Y`${separator}${uid}${separator}${title}${separator}${buddies} >> ${2}${simple_suffix} + echo `date -d @${timestamp} +%d/%m/%Y`${separator}${uid}${separator}${title}${separator}${buddies} >> ${DEST}${simple_suffix} fi - if [ -z $WHOLE ] + if [ ! -z $WHOLE ] then - echo ${activity}${separator}${timestamp}${separator}${uid}${separator}${title}${separator}${title_set}${separator}${buddies} >> $2 + echo ${activity}${separator}${timestamp}${separator}${uid}${separator}${title}${separator}${title_set}${separator}${buddies} >> $DEST fi exit 0 @@ -141,7 +132,7 @@ do USERNAME=$OPTARG ;; s) - if [ ! -d "$OPTARG" ] + if [ ! -r "$OPTARG" ] then echo "Error, path providen incorrect (check permissions)" exit 1 @@ -167,7 +158,7 @@ done if [ ! -z $CHILD ] # Am I a child process used for parsing? then - par $4 $DEST $WHOLE $BASIC + parse else if [ -z $USERNAME ] then @@ -204,7 +195,7 @@ fi # Now we call ourself to be able to inter in the function. Also used to run in concurrency (remove the & to debug…) #find $SOURCE -name "*$metadata" -exec $0 -x $callme -s '{}' -d $out $WHOLE $BASIC \;& -find $SOURCE -name "*$metadata" -exec $0 -x $callme -s '{}' -d $out $WHOLE $BASIC \; +find $SOURCE -name "*$metadata" -exec $0 -x $callme -s '{}' -d $out $WHOLE $BASIC \;& wait # wait the end of parsing if [ ! -z $BASIC ] |