Last active
February 15, 2020 21:27
-
-
Save electron0zero/3836953b8c87d90ff686a3c28870ca7b to your computer and use it in GitHub Desktop.
URL to Markdown link with title - bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bash script to get title of a url and then dump it in Markdown format link | |
# credit: https://unix.stackexchange.com/a/103253 | |
function url_to_md( ) { | |
t=$(wget -qO- $1 | perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)\s*<\/title/si') | |
echo "[$t]($1)" | |
} | |
# example usage | |
~/wd $ url_to_md https://kubernetes.io/docs/tasks/debug-application-cluster/debug-init-containers/ | |
[Debug Init Containers - Kubernetes](https://kubernetes.io/docs/tasks/debug-application-cluster/debug-init-containers/) | |
~/wd $ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment