~m-grant-prg/mget/trunk

« back to all changes in this revision

Viewing changes to src/prg/bash/mget.sh.in

  • Committer: Mark Grant
  • Date: 2019-09-06 14:34:14 UTC
  • mfrom: (1.1.12)
  • Revision ID: m.grant.prg@gmail.com-20190906143414-fcxb4dvj91tyb1pc
Merge new upstream development release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
# 03/12/2017    MG      1.1.8   Add SPDX license tags to source files.  #
136
136
#                               Adopt normal exit code policy; 0 on     #
137
137
#                               success, 1 on failure.                  #
138
 
# 04/09/2019    MG      1.2.1   Do not hardcode outputprefix.           #
 
138
# 06/09/2019    MG      1.2.1   Do not hardcode outputprefix.           #
139
139
#                               Use C style formatting of conditional   #
140
140
#                               and loop statements.                    #
141
141
#                               Use true booleans.                      #
150
150
#                               configure in shebang.                   #
151
151
#                               Do not automatically create the config  #
152
152
#                               file.                                   #
 
153
#                               If get is successful delete entry from  #
 
154
#                               source file, otherwise retain for       #
 
155
#                               possible re-run.                        #
153
156
#                                                                       #
154
157
#########################################################################
155
158
 
442
445
validate_target_dir
443
446
 
444
447
# Now get the files
 
448
touch "$sourcefile".new
 
449
 
445
450
old_IFS=$IFS
446
451
IFS="/"
447
452
exec 3<"$sourcefile"
460
465
        # If this wget errored then skip to the next.
461
466
        if (( status )); then
462
467
                rm -f "$targetdir/$outputfile"
 
468
                printf "%s\n" "${input[*]}" >> "$sourcefile".new
463
469
                continue
464
470
        fi
465
471
 
494
500
exec 3<&-
495
501
IFS=$old_IFS
496
502
 
 
503
rm -f "$sourcefile"
 
504
mv -f "$sourcefile".new "$sourcefile"
 
505
 
497
506
# If persist is TRUE, save parameters.
498
507
if $persist; then
499
508
        rm -f $conffile