Skip to content

Instantly share code, notes, and snippets.

@xinyangli
Last active November 13, 2023 05:26
Show Gist options
  • Save xinyangli/71b532da09a3f6f1c0b6d0b7059499cd to your computer and use it in GitHub Desktop.
Save xinyangli/71b532da09a3f6f1c0b6d0b7059499cd to your computer and use it in GitHub Desktop.
Generate a markdown file that presents a table grid of all PNG images in the current directory,
#!/bin/bash
md_filename="vis.md"
cnt=0
echo "| | | | |" >> $md_filename
echo "|-|-|-|-|" >> $md_filename
for file in $(ls | grep png)
do
printf "| ![$file](./$file) 
 $file" >> $md_filename;
if [ $(($cnt%4)) -eq 3 ];
then
printf "|\n" >> $md_filename;
fi;
let cnt=cnt+1;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment