inital commit
This commit is contained in:
17
convert.sh
Normal file
17
convert.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Get output file as argument or fall back to `dtos`.
|
||||
of="$1"
|
||||
[ -z "$1" ] && of='dtos'
|
||||
|
||||
# Extract the shebang from README.org and write it to new file.
|
||||
grep ':shebang' README.org | cut -d \" -f2 > "$of"
|
||||
|
||||
# Extract all '#+begin/end_src' blocks from README.org and append them to file;
|
||||
# Remove the last line of whitespace since emacs does that too.
|
||||
awk '/^#\+begin_src/{flag=1;next}/^#\+end_src/{flag=0;print ""}flag' \
|
||||
README.org | head -n -1 >> "$of"
|
||||
|
||||
# Make the new file executable
|
||||
chmod +x "$of"
|
||||
|
||||
Reference in New Issue
Block a user