<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://dev1galaxy.org/extern.php?action=feed&amp;tid=4968&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / [SOLVED] Launching a terminal from a subshell ?]]></title>
		<link>http://dev1galaxy.org/viewtopic.php?id=4968</link>
		<description><![CDATA[The most recent posts in [SOLVED] Launching a terminal from a subshell ?.]]></description>
		<lastBuildDate>Sat, 16 Apr 2022 09:01:43 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: [SOLVED] Launching a terminal from a subshell ?]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=35622#p35622</link>
			<description><![CDATA[<p>The <span class="bbc">echo</span> command is using <a href="https://en.wikipedia.org/wiki/ANSI_escape_code" rel="nofollow">ANSI escape sequences</a> — <span class="bbc">\033]0</span> sets a title in xterm (other terminals might need <span class="bbc">\033]2</span>) and <span class="bbc">\007</span> (the bell character) unsets that option.</p><p>EDIT: or use</p><div class="codebox"><pre><code>printf &quot;\e]0;%s\a&quot; &quot;Please enter password&quot;</code></pre></div><p>Because <span class="bbc">echo -e</span> is unspecified in the POSIX standard <img src="http://dev1galaxy.org/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Sat, 16 Apr 2022 09:01:43 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=35622#p35622</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Launching a terminal from a subshell ?]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=35612#p35612</link>
			<description><![CDATA[<p>🙇 Thanks again HOAS !!! that&#039;s a detailed answer, thank you so much !</p><p>I&#039;m ashamed to ask, but does someone have a an explanation about</p><div class="codebox"><pre><code>echo -ne &quot;\033]0;Title Of Terminal\007&quot;</code></pre></div><p>&#160; <br />I&#039;ve <span class="bbc">man echo</span> But this doesn&#039;t help to understand why the echo is going to the title.. (I&#039;ve look also on some&#039;s search engine but found nothing.. <img src="http://dev1galaxy.org/img/smilies/hmm.png" width="15" height="15" alt="hmm" /> )</p><p>Thanks</p>]]></description>
			<author><![CDATA[dummy@example.com (SpongeBOB)]]></author>
			<pubDate>Sat, 16 Apr 2022 05:38:15 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=35612#p35612</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Launching a terminal from a subshell ?]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=35596#p35596</link>
			<description><![CDATA[<div class="quotebox"><cite>SpongeBOB wrote:</cite><blockquote><div><p>I just need to found a way to set the title of the terminal</p></div></blockquote></div><div class="codebox"><pre><code>echo -ne &quot;\033]0;Title Of Terminal\007&quot;</code></pre></div><div class="quotebox"><cite>SpongeBOB wrote:</cite><blockquote><div><p>why are you using <span class="bbc">#!/bin/sh</span> ?</p></div></blockquote></div><p>Because Debian &amp; Devuan both link /bin/sh to dash, which is significantly lighter, faster and less buggy than bash. The only reason to use bash is if you need the extra features (called <a href="https://mywiki.wooledge.org/Bashism" rel="nofollow">bashisms</a>).</p><p>And on a more practical level:</p><div class="codebox"><pre><code>alpine:~$ bash
/bin/oksh: bash: not found
127alpine:~$</code></pre></div><p>I dual-boot Arch &amp; Alpine Linux but the latter doesn&#039;t have bash installed and I prefer to create portable scripts (which will also work on BSD and other UNIX-like systems).</p><p>See <a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html" rel="nofollow">sh(1)</a> &amp; <a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html" rel="nofollow">https://pubs.opengroup.org/onlinepubs/9 … hap02.html</a> for the full /bin/sh POSIX specification.</p><p>EDIT:</p><div class="quotebox"><cite>SpongeBOB wrote:</cite><blockquote><div><p>I&#039;ve tried also --&gt;</p><div class="codebox"><pre><code>Exec=xfce4-terminal -e passwd &amp;&amp; rm -rf ~/.config/autostart/</code></pre></div><p>But of course it&#039;s not working</p></div></blockquote></div><p>The <span class="bbc">Exec</span> line just runs a command but <span class="bbc">&amp;&amp;</span> is shell syntax so to make that work you would have to run it through a shell:</p><div class="codebox"><pre><code>Exec=x-terminal-emulator -e sh -c &quot;passwd &amp;&amp; rm ~/.config/autostart/oneshot.desktop&quot;</code></pre></div><p>So no need for /usr/local/bin/oneshot <img src="http://dev1galaxy.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Fri, 15 Apr 2022 09:14:56 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=35596#p35596</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Launching a terminal from a subshell ?]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=35595#p35595</link>
			<description><![CDATA[<p>Voila,</p><p>I&#039;ve done it slightly differently</p><p>So I&#039;m using /etc/skel/.config/autostart/oneshot.desktop</p><div class="codebox"><pre><code>[Desktop Entry]
Exec=oneshot
Terminal=true</code></pre></div><p>and here the /usr/local/bin/oneshot</p><div class="codebox"><pre><code>#!/bin/bash
passwd
rm -rfv ~/.config/autostart/oneshot.desktop</code></pre></div><p>way easier than my previous solution <img src="http://dev1galaxy.org/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p><p>I just need to found a way to set the title of the terminal .</p><p>btw @HOAS why are you using <span class="bbc">#!/bin/sh</span> ?</p>]]></description>
			<author><![CDATA[dummy@example.com (SpongeBOB)]]></author>
			<pubDate>Fri, 15 Apr 2022 08:17:15 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=35595#p35595</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Launching a terminal from a subshell ?]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=35594#p35594</link>
			<description><![CDATA[<p>Thank you HOAS !</p><div class="quotebox"><blockquote><div><p>The XY Problem link I provided explains why it is always best to explain exactly what you&#039;re trying to do rather than just ask about a specific problem.</p></div></blockquote></div><p>I&#039;ve just read it and it totally make sens. I think also it&#039;s legitimate that if a &quot;noob&quot; took time on Y and <strong>believe</strong> he is that close to solve Y and therefore X. He is thinking that it will take less time to explain Y instead of the all X[Y].<br />For my part, If I would need help with Y I will included the X as much as possible 😅</p><div class="quotebox"><blockquote><div><p>You have edited the wrong section. Revert that change and instead add <span class="bbc">-e passwd</span> to line 173 (<em>ie</em>, the <span class="bbc">Exec</span> line without the <span class="bbc">--preferences</span> option)...</p></div></blockquote></div><p> That work ! I&#039;ve tried also --&gt;</p><div class="codebox"><pre><code>Exec=xfce4-terminal -e passwd &amp;&amp; rm -rf ~/.config/autostart/</code></pre></div><p>But of course it&#039;s not working, that would have been too easy <img src="http://dev1galaxy.org/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p><div class="quotebox"><blockquote><div><p>EDIT: just read the OP again. To make this only run once per user we would have to call a script instead that checks for a marker file left after completion and only runs the terminal if the marker file is not present (and then creates the marker file afterwards ofc).</p></div></blockquote></div><p><del>Would you have a solution that instead of create a marker file, just delete the ~/.config/autostart/xfce4-terminal.desktop ?</del></p><p><del>I will try now (base on your examples)&#160; and post-it if I manage...</del></p><p>out of topics: Damn I spend my ~life to be a windows guru and the conversion is hard, but must ! just for ethic.</p>]]></description>
			<author><![CDATA[dummy@example.com (SpongeBOB)]]></author>
			<pubDate>Fri, 15 Apr 2022 07:39:01 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=35594#p35594</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Launching a terminal from a subshell ?]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=35566#p35566</link>
			<description><![CDATA[<div class="quotebox"><cite>SpongeBOB wrote:</cite><blockquote><div><div class="codebox"><pre><code>mkdir -p ~/.config/autostart
cp /usr/share/applications/xfce4-terminal.desktop ~/.config/autostart/</code></pre></div><p>indeed start the terminal, but I would like it launch within -e &#039;passwd&#039; is it possible ?</p></div></blockquote></div><p>Ah, I see, my apologies — I thought you just wanted to autostart a terminal emulator. The XY Problem link I provided explains why it is always best to explain exactly what you&#039;re trying to do rather than just ask about a specific problem.</p><div class="quotebox"><cite>SpongeBOB wrote:</cite><blockquote><div><p>I edited the ~/.config/autostart/xfce4-terminal.desktop</p><p>was</p><div class="codebox"><pre><code>...
Exec=xfce4-terminal --preferences</code></pre></div><p>to</p><div class="codebox"><pre><code>...
Exec=xfce4-terminal -e &#039;passwd&#039; --preferences</code></pre></div></div></blockquote></div><p>You have edited the wrong section. Revert that change and instead add <span class="bbc">-e passwd</span> to line 173 (<em>ie</em>, the <span class="bbc">Exec</span> line without the <span class="bbc">--preferences</span> option). That works for me in GNOME 42 under Arch anyway.</p><p>EDIT: just read the OP again. To make this only run once per user we would have to call a script instead that checks for a marker file left after completion and only runs the terminal if the marker file is not present (and then creates the marker file afterwards ofc).</p><p>So something like this in ~/.config/autostart/oneshot.desktop:</p><div class="codebox"><pre><code>[Desktop Entry]
Exec=oneshot</code></pre></div><p>With this in /usr/local/bin/oneshot:</p><div class="codebox"><pre><code>#!/bin/sh

marker=&quot;$HOME&quot;/.oneshot

if [ ! -f &quot;$marker&quot; ] ; then
   # need to run the commands in a shell to prevent $marker being
   # created if the passwd command is exited before completion
   x-terminal-emulator -e sh -c &quot;passwd &amp;&amp; touch $marker&quot;
fi</code></pre></div><p>Remember to mark the oneshot script executable after creating it.</p><p>EDIT2: my ~.xsessionrc suggestion didn&#039;t work because you&#039;re using <span class="bbc">startxfce4</span> rather than <span class="bbc">startx</span>. Read the Debian Wiki Xsession link I provided in my first post to get a better idea of how to launch the desktop &quot;properly&quot;.</p><p>EDIT3: this also works:</p><div class="codebox"><pre><code>[Desktop Entry]
Exec=oneshot
Terminal=true</code></pre></div><div class="codebox"><pre><code>#!/bin/sh

marker=&quot;$HOME&quot;/.oneshot

if [ ! -f &quot;$marker&quot; ] ; then
   passwd &amp;&amp; touch &quot;$marker&quot;
fi</code></pre></div><p>But then the terminal briefly appears then closes if &quot;$marker&quot; is present, which doesn&#039;t happen with my first suggestion.</p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Sun, 10 Apr 2022 10:20:12 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=35566#p35566</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Launching a terminal from a subshell ?]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=35564#p35564</link>
			<description><![CDATA[<p>Thank you @HOAS,</p><p>unfortunately&#160; </p><div class="codebox"><pre><code>echo &#039;x-terminal-emulator &amp;&#039; &gt;&gt; ~/.xsessionrc</code></pre></div><p>had no effect (visible, most probably it run in the background)</p><div class="codebox"><pre><code>mkdir -p ~/.config/autostart
cp /usr/share/applications/xfce4-terminal.desktop ~/.config/autostart/</code></pre></div><p>indeed start the terminal, but I would like it launch within -e &#039;passwd&#039; is it possible ?</p><p>I edited the ~/.config/autostart/xfce4-terminal.desktop</p><p>was</p><div class="codebox"><pre><code>...
Exec=xfce4-terminal --preferences</code></pre></div><p>to</p><div class="codebox"><pre><code>...
Exec=xfce4-terminal -e &#039;passwd&#039; --preferences</code></pre></div><p>but that&#039;s have no effect either</p>]]></description>
			<author><![CDATA[dummy@example.com (SpongeBOB)]]></author>
			<pubDate>Sun, 10 Apr 2022 05:28:51 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=35564#p35564</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Launching a terminal from a subshell ?]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=35464#p35464</link>
			<description><![CDATA[<div class="quotebox"><cite>SpongeBOB wrote:</cite><blockquote><div><p>I would my script (.OneTime.sh) launch a terminal for the user</p></div></blockquote></div><div class="codebox"><pre><code>echo &#039;x-terminal-emulator &amp;&#039; &gt;&gt; ~/.xsessionrc</code></pre></div><p>See also <a href="https://wiki.debian.org/Xsession" rel="nofollow">https://wiki.debian.org/Xsession</a> &amp; <a href="https://xyproblem.info/" rel="nofollow">https://xyproblem.info/</a></p><p>Alternatively use XDG autostart:</p><div class="codebox"><pre><code>mkdir -p ~/.config/autostart
cp /usr/share/applications/xfce4-terminal.desktop ~/.config/autostart/</code></pre></div><p>I think Xfce has an autostart GUI buried away somewhere in their menu labyrinth.</p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Sat, 02 Apr 2022 09:51:53 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=35464#p35464</guid>
		</item>
		<item>
			<title><![CDATA[[SOLVED] Launching a terminal from a subshell ?]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=35456#p35456</link>
			<description><![CDATA[<p>Hi everyone,</p><p>I&#039;ve created a script that run only once after an user login for the first time.</p><p>I launch the script trough ~/.profile</p><p>Like this</p><div class="quotebox"><cite>.profile wrote:</cite><blockquote><div><div class="codebox"><pre><code>./.OneTime.sh &amp;
startxfce4</code></pre></div></div></blockquote></div><p>So I launch my script as a subshell with the &amp; at the end of the command because I need xfce to have generated some files..<br />and If I do</p><div class="quotebox"><cite>.profile wrote:</cite><blockquote><div><div class="codebox"><pre><code>startxfce4
./.OneTime.sh</code></pre></div></div></blockquote></div><p>My script will never be executed...</p><p>I would my script (.OneTime.sh) launch a terminal for the user</p><p>I&#039;ve tried</p><div class="codebox"><pre><code>xfce4-terminal -e &#039;passwd&#039; </code></pre></div><p>But I don&#039;t see the terminal....</p><p>Any ideas ?</p>]]></description>
			<author><![CDATA[dummy@example.com (SpongeBOB)]]></author>
			<pubDate>Sat, 02 Apr 2022 05:11:49 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=35456#p35456</guid>
		</item>
	</channel>
</rss>
