bash cgi direcotry listing
  1. cat << EOF
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>Content of DIR</title>
  6. </head>
  7. <body text="#384239" bgcolor="#FFFFFF" link="#384239" vlink="#384239" alink="#384239">
  8. <p> </p>
  9. EOF
  10. HR1='<a href="'
  11. HR2='">'
  12. HR3='</a>'
  13. $(ls -1 --hide=index.ls.sh ./ > /tmp/list.tmp)
  14.  for lst in $(cat -E /tmp/list.tmp |sed 's/\$/<br>/g')
  15.  do
  16.  BN=$(basename $lst)
  17.  #echo $BN
  18.  echo $HR1$(echo $BN |sed 's/<br>//g')$HR2$BN$HR3
  19.  done
  20. rm /tmp/list.tmp
  21. cat << EOF
  22. </body>
  23. </html>
  24. EOF
Parsed in 0.012 seconds