Revision 0dc9f2f9 setup.sh
| setup.sh | ||
|---|---|---|
| 169 | 169 |
# usage: setLogFile [--option=<option>] [--quiet] <infile> <outvar> |
| 170 | 170 |
# arguments: --option=<option> |
| 171 | 171 |
# Select what to do if <file> already exists. |
| 172 |
# Possible values are 'a', 'r' and 'n'. |
|
| 173 |
# - a: append |
|
| 172 |
# Possible values are 'a', 'c', 'r' and 'n'. |
|
| 173 |
# - a: append (starts with a separator) |
|
| 174 |
# - c: continue (does not insert a seperator) |
|
| 174 | 175 |
# - r: delete and restart |
| 175 | 176 |
# - n: no log |
| 176 | 177 |
# If no option is secified but <file> exists, an interactive selection is provided. |
| ... | ... | |
| 226 | 227 |
fi |
| 227 | 228 |
# evaluate option |
| 228 | 229 |
case "$option" in |
| 229 |
a) |
|
| 230 |
a|c)
|
|
| 230 | 231 |
if [ $quiet = false ]; then |
| 231 | 232 |
printInfo "appending log to $filepath\n" |
| 232 | 233 |
fi |
| 233 |
printf "\n" >> $filepath |
|
| 234 |
printf "######################################################################\n" >> $filepath |
|
| 235 |
printf "\n" >> $filepath |
|
| 234 |
if [ $option != c ]; then |
|
| 235 |
printf "\n" >> $filepath |
|
| 236 |
printf "######################################################################\n" >> $filepath |
|
| 237 |
printf "\n" >> $filepath |
|
| 238 |
fi |
|
| 236 | 239 |
;; |
| 237 | 240 |
r) |
| 238 | 241 |
echo -n "" > $filepath |
| ... | ... | |
| 528 | 531 |
fi |
| 529 | 532 |
# optionally force silent appending |
| 530 | 533 |
if [[ "$cmd" = "--LOG"* ]]; then |
| 531 |
setLogFile --option=a --quiet "$logfile" LOG_FILE
|
|
| 534 |
setLogFile --option=c --quiet "$logfile" LOG_FILE
|
|
| 532 | 535 |
else |
| 533 | 536 |
setLogFile "$logfile" LOG_FILE |
| 534 | 537 |
printf "\n" |
Also available in: Unified diff