#! /bin/bash if [ $# -ne 3 ]; then echo "Usage: create_bus_save_file " exit 127 fi echo "simulator lang=spectre" > $3 echo "save \\ " >> $3 num_bits_minus_1=`expr $2 - 1 | bc` for i in $(seq 0 ${num_bits_minus_1}); do if [[ $i -lt ${num_bits_minus_1} ]] then echo "$1<$i> \\" >> $3; else echo "$1<$i>" >> $3; fi done echo "Done! Output filename is \"$3\"."