- 2023
- \(() in Bash vs in Zsh]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9USUwvMjAyMy8yMDIzLTAxLTAzLSgpX2luX2Jhc2hfdnNfaW5fenNoLmh0bWwkKCktaW4tQmFzaC12cy1pbi1ac2g="} [Get Function from Modules Using its Name]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9USUwvMjAyMy8yMDIzLTAxLTEzLWdldF9mdW5jdGlvbl93aXRoX2l0c19uYW1lLmh0bWxHZXQtRnVuY3Rpb24tZnJvbS1Nb2R1bGVzLVVzaW5nLWl0cy1OYW1l"} [Subtle Bug: Variable Shadows Function]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9USUwvMjAyMy8yMDIzLTA0LTAyLXZhcmlhYmxlX3NoYWRvd3NfZnVuY3Rpb24uaHRtbFN1YnRsZS1CdWc6LVZhcmlhYmxlLVNoYWRvd3MtRnVuY3Rpb24="} [Incorporating Google Admob in SwiftUI]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9USUwvMjAyMy8yMDIzLTEwLTMwLUluY29ycG9yYXRpbmdfR29vZ2xlX0FkbW9iX2luX1N3aWZ0VUkuaHRtbEluY29ycG9yYXRpbmctR29vZ2xlLUFkbW9iLWluLVN3aWZ0VUk="} [Posts]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6UG9zdHM="} [/index.html]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6L2luZGV4Lmh0bWw="} [TIL]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6VElM"} [/TIL.html]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6L1RJTC5odG1s"} [Books]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6Qm9va3M="} [/books/books.html]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6L2Jvb2tzL2Jvb2tzLmh0bWw="} [AI Art]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6QUkgQXJ0"} [Stable Diffusion]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6U3RhYmxlIERpZmZ1c2lvbg=="} [/ai_art-sd.html]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6L2FpX2FydC1zZC5odG1s"} [Disco Diffusion]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6RGlzY28gRGlmZnVzaW9u"} [/ai_art-dd.html]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6L2FpX2FydC1kZC5odG1s"} [Projects]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6UHJvamVjdHM="} [/projects.html]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6L3Byb2plY3RzLmh0bWw="} [Apps]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6QXBwcw=="} [/Apps/Long-Text-Pic.html]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6L0FwcHMvTG9uZy1UZXh0LVBpYy5odG1s"} [About]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6QWJvdXQ="} [/about.html]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6L2Fib3V0Lmh0bWw="} [https://github.com/feynlee]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6aHR0cHM6Ly9naXRodWIuY29tL2ZleW5sZWU="} [https://twitter.com/curiosity_notes]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6aHR0cHM6Ly90d2l0dGVyLmNvbS9jdXJpb3NpdHlfbm90ZXM="} [Subscribe to Posts]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6U3Vic2NyaWJlIHRvIFBvc3Rz"} [https://feynlee.github.io/curiosity-notes/index.xml]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6aHR0cHM6Ly9mZXlubGVlLmdpdGh1Yi5pby9jdXJpb3NpdHktbm90ZXMvaW5kZXgueG1s"} [Subscribe to TIL]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6U3Vic2NyaWJlIHRvIFRJTA=="} [https://feynlee.github.io/curiosity-notes/TIL.xml]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6aHR0cHM6Ly9mZXlubGVlLmdpdGh1Yi5pby9jdXJpb3NpdHktbm90ZXMvVElMLnhtbA=="} [Subscribe to Projects]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6U3Vic2NyaWJlIHRvIFByb2plY3Rz"} [https://feynlee.github.io/curiosity-notes/projects.xml]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXI6aHR0cHM6Ly9mZXlubGVlLmdpdGh1Yi5pby9jdXJpb3NpdHktbm90ZXMvcHJvamVjdHMueG1s"} [2023]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWJyZWFkY3J1bWJzLTIwMjM="} [\)() in Bash vs in Zsh
$() Command Substitution in Bash vs in Zsh
Command Line
Zsh
Bash
$() concatenates the results into one single line in bash, but not in zsh.
Author
Ziyue Li
Published
January 3, 2023
A simple learning today: when using $()
in Bash, it concatenates the outputs into one single line, while in Zsh, it does not seem to do so.
In bash
outputs something like
But when the same commands are executed in Zsh, I got
with the line breaks preserved.