blockshell/add_blocks.sh

19 lines
399 B
Bash
Executable File

#!/bin/sh
CMD=""
PREVIFS=$IFS
IFS=','
[ $# -ne 1 ] && { echo "Usage: add_blocks <file.csv>"; exit 1; }
[ ! -f $1 ] && { echo "file $1 not found"; exit 1; }
while read uid mail firstname lastname end
do
CMD="${CMD}dotx $uid $mail $firstname $lastname\n"
done < $1
# Add blocks to existing blockchain (if it exists) or to a new blockchain
printf $CMD | blockshell load chain.txt
IFS=$PREVIFS