#!/bin/bash
#script to embed an mp3 into a shell script.
#Usage:
#cat thisScript.sh mp3FileName.mp3 > play.sh
#bash play.sh
ARCHIVE=`awk '/^__ARCHIVE_BELOW__/ {print NR + 1; exit 0; }' $0`
#redirect embedded archive to a file.
#specificly, read the script, get the number of lines before ARCHIVE_BELOW, and redirect after that to a file
tail -n+$ARCHIVE $0 > file.mp3
#play the file once and exit
cvlc --play-and-exit --ignore-config file.mp3
rm file.mp3
exit 0
__ARCHIVE_BELOW__