Skip to content

Instantly share code, notes, and snippets.

@rubo77
Last active July 18, 2020 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubo77/c7a9434eb104c00bf8772b2278284360 to your computer and use it in GitHub Desktop.
Save rubo77/c7a9434eb104c00bf8772b2278284360 to your computer and use it in GitHub Desktop.
automatically create an index.html file in the current folder, that contains the whole path
#!/bin/bash
# scriptname: /usr/local/sbin/directory-long-index.sh
#
# the directory_root without slash at the end:
WEB=/var/www/
#reacheable url from inside the server:
URL=http://localhost
P=$(pwd|sed "s|$WEB/||")
echo "download $URL/$P/ to index.html"
curl "$URL/$P/" -o index.html
sed -i 's|href="\(.*\)".*</a>|style="display:inline-block;min-width:500px" href="\1">\1</a>|' index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment