<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="124459" data-post-id="124459">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Exadra37" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Exadra37/120/9183_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Exadra37
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="12" data-topic="21617">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>That tells me that there was bad input on the commandline or an an env-var,</p>
</blockquote>
</aside>
<p>So turns out the culprit was this:</p>
<pre data-code-wrap="bash"><code class="lang-bash"> ENV_VAR=$(hostname -i)
</code></pre>
<p>Needs to be:</p>
<pre data-code-wrap="bash"><code class="lang-bash"> ENV_VAR=$(echo -n $(hostname -i))
</code></pre>
<p>Feel free to suggested a cleaner way of doing it…</p>
<p>Maybe:</p>
<pre data-code-wrap="bash"><code class="lang-bash">ENV_VAR=$(hostname -i | tr -d '\n')
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="124459" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-possible-to-use-observer-with-multiple-applications/21617/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-124459" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="124459"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="124465" data-post-id="124465">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Exadra37" data-post="13" data-topic="21617">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/exadra37/48/9183_2.png" class="avatar"> Exadra37:</div>
<blockquote>
<p>ENV_VAR=$(hostname -i)</p>
</blockquote>
</aside>
<p>That should work just fine, trailing newlines are not kept…  o.O</p>
<pre data-code-wrap="zsh"><code class="lang-zsh">╰─➤  ENV_VAR=$(hostname -i)

╰─➤  ENV_VAR1=$(echo -n $(hostname -i))

╰─➤  [ "${ENV_VAR}" = "${ENV_VAR1}" ] &amp;&amp; echo they are identical || echo they are not identical
they are identical
</code></pre>
<p>So… that’s weird…  o.O</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="124465" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-possible-to-use-observer-with-multiple-applications/21617/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-124465" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="124465"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="124476" data-post-id="124476">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Exadra37" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Exadra37/120/9183_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Exadra37
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="14" data-topic="21617">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>So… that’s weird… o.O</p>
</blockquote>
</aside>
<p>You need to save the output into a file to see the new line and see the file in a text editor, <code>cat</code> will not show the new line <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p>
<p>With new line in the file:</p>
<pre data-code-wrap="bash"><code class="lang-bash">$ hostname -i &gt; out.txt
$ echo $(hostname -i) &gt; out2.txt
</code></pre>
<p>Without a new line in the file:</p>
<pre data-code-wrap="bash"><code class="lang-bash">$ echo -n $(hostname -i) &gt; out3.txt

$ hostname -i | tr -d '\n' &gt; out4.txt
</code></pre>
<p>My shell</p>
<pre data-code-wrap="bash"><code class="lang-bash">$ echo $SHELL
/usr/bin/zsh

$ echo $ZSH
/home/exadra37/.oh-my-zsh
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="124476" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-possible-to-use-observer-with-multiple-applications/21617/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-124476" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="124476"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="124487" data-post-id="124487">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>That’s saving to a file though, which would have a newline.  The thing about a variable in bash/zsh is that it doesn’t keep the newline because newlines are part of <code>$IFS</code> (well, unless you changed <code>$IFS</code>, which would break a lot of things), so I’m still thinking a <code>"</code> is in use somewhere where it shouldn’t be (which inhibits the this)?</p>
<p>For note though, replacing a newline via calling another program can be slow in a loop, so you’d probably want to use shell-string-replacement instead (like <code>NR='\r'</code> then <code>%{blahvar%$NL}</code>), but if not in a tight loop it doesn’t matter.  ^.^</p>
<p>Still though:</p>
<pre data-code-wrap="zsh"><code class="lang-zsh">╰─➤  BLAH=$(hostname -i) 

╰─➤  printf "&gt;${BLAH}&lt;"
&gt;127.0.1.1&lt;% 

╰─➤  printf "&gt;${BLAH}&lt;\n"
&gt;127.0.1.1&lt;

# Now of course streaming the variable into a program will include the newline:
╰─➤  wc &lt;&lt;&lt; "$BLAH"
 1  1 10

# But passing it as an argument will not:
╰─➤  perl -e 'print $ARGV[0]; print " -&gt; "; print length($ARGV[0])' $BLAH
127.0.1.1 -&gt; 9%

╰─➤  python3 -c 'import sys; print(repr(sys.argv)); print(len(sys.argv[1]))' $BLAH
['-c', '127.0.1.1']
9

╰─➤  elixir -e 'System.argv() |&gt; IO.inspect(); System.argv() |&gt; hd() |&gt; String.length() |&gt; IO.inspect()' $BLAH
["127.0.1.1"]
9
</code></pre>
<p>So I think I’m still not seeing enough of your script to see the issue, like where and how the <code>ENV_VAR</code> is used…  ^.^;</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="124487" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-possible-to-use-observer-with-multiple-applications/21617/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-124487" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="124487"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>