Script to set background to reveal slides

17th July

Sir told me to make a script to create slides just by putting some images into a folder. Nice idea!

After trying some commands interactively, I wrapped the commands and first tried for manipulating text of a file. I got opportunity to use the sed (stream editor). Here is the script for that: Click here to see the script.

let count=1
while read line
sed -i -e s/'variable('$count')'/$line/ filename

Here list contains the list of names of images that are to be replaced with the ‘variable()’ in the file ‘filename’.

Then I got the idea and created another script to add slides into the reveal-md presentation file.

Here is the link to script:


while read line
echo "">>
echo "---">>
echo "">>
echo "<section data-background="images/$line"></section>">> 

The lines I’ve echo’ed are the syntax to add a new slide in reveal-md presentation (three hyphens surrounded by new lines). Basically a new line is fetched from the file “list” (which contains the list of images in the images folder) and then it’s appended (due to ‘>>‘) in the file by inserting the image names (from file ‘list’) within section tags (to change background).

After that I pushed the code to github.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s