Bash one-liner to generate markdown images

I like these one line scripts that save a whole bunch of time. I wish the entire world knew the power of scripting from the command line!

A simple bash one(ish)-liner to generate the markdown syntax to display an entire directory of photos:

[email protected]:~/www/static/images/faucet $ for i in `ls -1` ; do echo " "; echo $i; echo "\![faucet](/images/faucet/$i)" | sed -e 's/^\\//g'; done

IMG_0385.JPG
![faucet](/images/faucet/IMG_0385.JPG)

IMG_0616.JPG
![faucet](/images/faucet/IMG_0616.JPG)

IMG_0968.JPG
![faucet](/images/faucet/IMG_0968.JPG)

IMG_0995.JPG
![faucet](/images/faucet/IMG_0995.JPG)

comments powered by Disqus