Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
Sylvester's answer is great, but I wanted to point out that interpolation only happens in double-quoted strings ("), not in single-quoted ones ('). If you have lines that don't need any variable o...
Answer
#2: Post edited
- [Sylvester's answer][sylvester] is great, but I wanted to point out that interpolation only happens in double-quoted strings (`"`), not in single-quoted ones (`'`).
- If you have lines that don't need any variable or command interpolation, you can single-quote and skip escapes:
- ```bash
- find . -name "*.py" -print0 | while read -d $'\0' file; do
- echo "\`$file\`"
- echo '```python'
- cat "$file"
- echo '```'
- echo
- done > all_code.md
- ```
On the other hand, you may find it's easier to read when you use a single quoting mechanism and use its escapes.- [sylvester]: https://software.codidact.com/posts/290084/290087#answer-290087
- [Sylvester's answer][sylvester] is great, but I wanted to point out that interpolation only happens in double-quoted strings (`"`), not in single-quoted ones (`'`).
- If you have lines that don't need any variable or command interpolation, you can single-quote and skip escapes:
- ```bash
- find . -name "*.py" -print0 | while read -d $'\0' file; do
- echo "\`$file\`"
- echo '```python'
- cat "$file"
- echo '```'
- echo
- done > all_code.md
- ```
- On the other hand, you may find code easier to read with the consistency of only one quoting mechanism and its escapes. That's personal preference.
- [sylvester]: https://software.codidact.com/posts/290084/290087#answer-290087
#1: Initial revision
[Sylvester's answer][sylvester] is great, but I wanted to point out that interpolation only happens in double-quoted strings (`"`), not in single-quoted ones (`'`). If you have lines that don't need any variable or command interpolation, you can single-quote and skip escapes: ```bash find . -name "*.py" -print0 | while read -d $'\0' file; do echo "\`$file\`" echo '```python' cat "$file" echo '```' echo done > all_code.md ``` On the other hand, you may find it's easier to read when you use a single quoting mechanism and use its escapes. [sylvester]: https://software.codidact.com/posts/290084/290087#answer-290087