Sunday, May 26, 2013

Bash variable into html

I have a script that gets the filenames in a folder and creates HTML link to them on my homepage. Here is the script:
#!/bin/bash
list_dir=ls -t /path/to/dir/ for i in $list_dir
do
echo '<a href="/path/to/dir/$i">$i</a>' >> /var/www/index.html
done
But when I check the var/www/index.html the code is submitted, but the variables have not been substituted. Any advice on how to fix this?

No comments:

Post a Comment