Script works. To test SPI just run the script and type
> echo -n "HI SPI" > /dev/spidev1.0
Set trigger on SCK/MOSI and catch your bits.
The best C-example how to work with spidev is famous https://www.kernel.org/doc/Documentation/spi/spidev_test.c
Be careful ! You should checkout spidev_test.c matching to your Linux kernel version! In opposite case you fail on libraries mismatch.