<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: HowTo: Add Pause Prompt In a Shell Script ( bash pause command )</title> <atom:link href="http://www.cyberciti.biz/tips/linux-unix-pause-command.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Spaldam</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-179004</link> <dc:creator>Spaldam</dc:creator> <pubDate>Sat, 04 Feb 2012 18:53:17 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-179004</guid> <description>It&#039;s not working for me.  I&#039;m not sure why.  The loop just keeps going.</description> <content:encoded><![CDATA[<p>It&#8217;s not working for me.  I&#8217;m not sure why.  The loop just keeps going.</p> ]]></content:encoded> </item> <item><title>By: Scott Dunn</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-178290</link> <dc:creator>Scott Dunn</dc:creator> <pubDate>Mon, 09 Jan 2012 23:21:39 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-178290</guid> <description>Thank you. I learned that the not so hard way. Trying it. :)</description> <content:encoded><![CDATA[<p>Thank you. I learned that the not so hard way. Trying it. :)</p> ]]></content:encoded> </item> <item><title>By: Bhanu</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-175146</link> <dc:creator>Bhanu</dc:creator> <pubDate>Sun, 23 Oct 2011 19:46:47 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-175146</guid> <description>This code worked for me well!
I am looking to pause the script multiple times. So, I used multiple pause statements after every 10 lines. It didn&#039;t work.
Does anyone know why?
Thanks.</description> <content:encoded><![CDATA[<p>This code worked for me well!</p><p>I am looking to pause the script multiple times. So, I used multiple pause statements after every 10 lines. It didn&#8217;t work.</p><p>Does anyone know why?</p><p>Thanks.</p> ]]></content:encoded> </item> <item><title>By: Augustus</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-172792</link> <dc:creator>Augustus</dc:creator> <pubDate>Tue, 26 Jul 2011 17:45:54 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-172792</guid> <description>The code worked except the comment should read &quot;Press the ENTER key to continue...&quot;.
Thank you!</description> <content:encoded><![CDATA[<p>The code worked except the comment should read &#8220;Press the ENTER key to continue&#8230;&#8221;.<br
/> Thank you!</p> ]]></content:encoded> </item> <item><title>By: roger</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-172505</link> <dc:creator>roger</dc:creator> <pubDate>Sat, 16 Jul 2011 01:39:36 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-172505</guid> <description>Thanks worked perfectly.  Wonder why they don&#039;t have this as a bash command...</description> <content:encoded><![CDATA[<p>Thanks worked perfectly.  Wonder why they don&#8217;t have this as a bash command&#8230;</p> ]]></content:encoded> </item> <item><title>By: JW</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-158740</link> <dc:creator>JW</dc:creator> <pubDate>Sat, 07 Aug 2010 19:32:17 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-158740</guid> <description>Thanks for script, I put it at the end of a function and it is helpful. How would I call a function when Enter is pressed? I tried the following but it didn&#039;t work:
function pause(){
read -p &quot;$*&quot;
Function_1
}
pause &quot;Enter to continue...&quot;</description> <content:encoded><![CDATA[<p>Thanks for script, I put it at the end of a function and it is helpful. How would I call a function when Enter is pressed? I tried the following but it didn&#8217;t work:</p><p>function pause(){<br
/> read -p &#8220;$*&#8221;<br
/> Function_1<br
/> }<br
/> pause &#8220;Enter to continue&#8230;&#8221;</p> ]]></content:encoded> </item> <item><title>By: tom3k</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-153450</link> <dc:creator>tom3k</dc:creator> <pubDate>Wed, 10 Feb 2010 12:06:16 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-153450</guid> <description>for anyone writing any cli based php scripts, and who doesnt feel like installing the whole ncurses package JUST to get the &#039;press enter to continue...&#039; functionality...
this method works great via
system(&#039;read.....
thanks! +5</description> <content:encoded><![CDATA[<p>for anyone writing any cli based php scripts, and who doesnt feel like installing the whole ncurses package JUST to get the &#8216;press enter to continue&#8230;&#8217; functionality&#8230;</p><p>this method works great via</p><p>system(&#8216;read&#8230;..</p><p>thanks! +5</p> ]]></content:encoded> </item> <item><title>By: Sanchit</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-152705</link> <dc:creator>Sanchit</dc:creator> <pubDate>Mon, 04 Jan 2010 12:56:38 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-152705</guid> <description>Hi,
I have one unix script file that has one command to execute a java program. That Java program is used to download a file from a server. After this command I have different commands (&quot;hdiutil checksum -type CRC32 &quot;) to execute on the downloaded file. My problem is that after executing the java command it is not waiting for the file to be downloaded from the server and executing that command and fails because still that file is not downloaded.
Can someone help me to resolve this issue. How should I wait fro the file to be downloaded then only it should execute the other commands?
Please help me to get out in to this situation as soon as possible...</description> <content:encoded><![CDATA[<p>Hi,<br
/> I have one unix script file that has one command to execute a java program. That Java program is used to download a file from a server. After this command I have different commands (&#8220;hdiutil checksum -type CRC32 &#8220;) to execute on the downloaded file. My problem is that after executing the java command it is not waiting for the file to be downloaded from the server and executing that command and fails because still that file is not downloaded.</p><p>Can someone help me to resolve this issue. How should I wait fro the file to be downloaded then only it should execute the other commands?</p><p>Please help me to get out in to this situation as soon as possible&#8230;</p> ]]></content:encoded> </item> <item><title>By: Pai</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-147726</link> <dc:creator>Pai</dc:creator> <pubDate>Wed, 18 Mar 2009 10:25:12 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-147726</guid> <description>echo &quot;Press any Key to continue&quot;
read -n1 -t5 any_key
-n1 -&gt; number of character it can read
-t5 -&gt; it will wait for 5 seconds the user to enter a char after 5 sec it will resume the flow</description> <content:encoded><![CDATA[<p>echo &#8220;Press any Key to continue&#8221;<br
/> read -n1 -t5 any_key</p><p>-n1 -&gt; number of character it can read<br
/> -t5 -&gt; it will wait for 5 seconds the user to enter a char after 5 sec it will resume the flow</p> ]]></content:encoded> </item> <item><title>By: g00ner</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-146491</link> <dc:creator>g00ner</dc:creator> <pubDate>Tue, 30 Dec 2008 11:17:13 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-146491</guid> <description>Being a windows admin this was of great help.</description> <content:encoded><![CDATA[<p>Being a windows admin this was of great help.</p> ]]></content:encoded> </item> <item><title>By: christ</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-146075</link> <dc:creator>christ</dc:creator> <pubDate>Tue, 09 Dec 2008 01:18:42 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-146075</guid> <description>&lt;code&gt; read is a good choice for pausing but, sometimes we are looking for - pause then continue command without user interference so i guess &lt;b&gt; sleep  &lt;/b&gt; is more realiable&lt;/code&gt;</description> <content:encoded><![CDATA[<p><code> read is a good choice for pausing but, sometimes we are looking for - pause then continue command without user interference so i guess <b> sleep </b> is more realiable</code></p> ]]></content:encoded> </item> <item><title>By: Diven</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-144731</link> <dc:creator>Diven</dc:creator> <pubDate>Fri, 22 Aug 2008 00:23:00 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-144731</guid> <description>I believe the following is at least very close to the behavior of the pause command.
&lt;code&gt;
function pause(){
read -s -n 1 -p &quot;Press any key to continue . . .&quot;
echo
}
&lt;/code&gt;</description> <content:encoded><![CDATA[<p>I believe the following is at least very close to the behavior of the pause command.</p><p><code><br
/> function pause(){<br
/> read -s -n 1 -p "Press any key to continue . . ."<br
/> echo<br
/> }<br
/> </code></p> ]]></content:encoded> </item> <item><title>By: LeMMiNGS</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-144138</link> <dc:creator>LeMMiNGS</dc:creator> <pubDate>Mon, 23 Jun 2008 02:35:00 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-144138</guid> <description>Cool to know that that works out aswell!!</description> <content:encoded><![CDATA[<p>Cool to know that that works out aswell!!</p> ]]></content:encoded> </item> <item><title>By: Alison</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-143239</link> <dc:creator>Alison</dc:creator> <pubDate>Fri, 21 Mar 2008 05:51:04 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-143239</guid> <description>Lifesaver. Thankyou. :)
(I needed to put in a &quot;are you sure&quot; message for windows users to be able to run scripts on a Linux box... who knows if it will help, but hey, at least it&#039;s a start.)</description> <content:encoded><![CDATA[<p>Lifesaver. Thankyou. :)</p><p>(I needed to put in a &#8220;are you sure&#8221; message for windows users to be able to run scripts on a Linux box&#8230; who knows if it will help, but hey, at least it&#8217;s a start.)</p> ]]></content:encoded> </item> <item><title>By: anders</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-141618</link> <dc:creator>anders</dc:creator> <pubDate>Mon, 05 Nov 2007 17:21:47 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-141618</guid> <description>Using simply read to pause&gt;nul can be quite useful too.
I ran into the need for pause in this simple bash script, where I pass a website as argument and the script tells me the password to the site from my personal password file. Note: one site and one password on each line, file mode should be 600.
The script is useful to have on my webserver which is always on and I can reach from work or anywhere whenever I need it.
#!/bin/bash
cat ~/my_passwords.txt &#124; grep $1; read; clear;
Hope this helps someone :-)</description> <content:encoded><![CDATA[<p>Using simply read to pause&gt;nul can be quite useful too.</p><p>I ran into the need for pause in this simple bash script, where I pass a website as argument and the script tells me the password to the site from my personal password file. Note: one site and one password on each line, file mode should be 600.<br
/> The script is useful to have on my webserver which is always on and I can reach from work or anywhere whenever I need it.</p><p>#!/bin/bash<br
/> cat ~/my_passwords.txt | grep $1; read; clear;</p><p>Hope this helps someone :-)</p> ]]></content:encoded> </item> <item><title>By: Smith</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-140973</link> <dc:creator>Smith</dc:creator> <pubDate>Sat, 01 Sep 2007 12:48:39 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-140973</guid> <description>read -p &quot;Press any key&quot;. doesn&#039;t provide the &#039;pause&#039; behavior.
It requires &#039;ENTER&#039; key to be pressed, so it becomes, &#039;press ENTER key&#039; instead of &#039;press any key&#039;.</description> <content:encoded><![CDATA[<p>read -p &#8220;Press any key&#8221;. doesn&#8217;t provide the &#8216;pause&#8217; behavior.</p><p>It requires &#8216;ENTER&#8217; key to be pressed, so it becomes, &#8216;press ENTER key&#8217; instead of &#8216;press any key&#8217;.</p> ]]></content:encoded> </item> <item><title>By: Gilles Allard</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-82684</link> <dc:creator>Gilles Allard</dc:creator> <pubDate>Mon, 05 Mar 2007 21:11:21 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-82684</guid> <description>If you need an exact replacement for PAUSE you need to use:
read -n 1 -p prompt
without -n, read will require the ENTER key.
I&#039;m not sure but -n may be a bash specific.</description> <content:encoded><![CDATA[<p>If you need an exact replacement for PAUSE you need to use:<br
/> read -n 1 -p prompt<br
/> without -n, read will require the ENTER key.<br
/> I&#8217;m not sure but -n may be a bash specific.</p> ]]></content:encoded> </item> <item><title>By: bhaskar</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-82562</link> <dc:creator>bhaskar</dc:creator> <pubDate>Mon, 05 Mar 2007 16:37:23 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-82562</guid> <description>One small tip,
If you do this in a while loop that reads from a file.
e.g.
while read line
do
.....
read -p somevar
.....
done &lt; somefile
It will not work as expected, as the input for the while loop is &quot;somefile&quot;, so the &quot;read -p &quot; inside the loop will read a line from somefile, instead of standard input.
To solve this you can use file descriptors.
so
exec 5</description> <content:encoded><![CDATA[<p>One small tip,<br
/> If you do this in a while loop that reads from a file.<br
/> e.g.<br
/> while read line<br
/> do<br
/> &#8230;..<br
/> read -p somevar<br
/> &#8230;..<br
/> done &lt; somefile</p><p>It will not work as expected, as the input for the while loop is &#8220;somefile&#8221;, so the &#8220;read -p &#8221; inside the loop will read a line from somefile, instead of standard input.</p><p>To solve this you can use file descriptors.</p><p>so</p><p>exec 5</p> ]]></content:encoded> </item> <item><title>By: nixcraft</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-82519</link> <dc:creator>nixcraft</dc:creator> <pubDate>Mon, 05 Mar 2007 14:46:24 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-82519</guid> <description>Sleep puts a delay for a specified amount of time w/o a prompt. So you need to use read –p so that user can hit a key.</description> <content:encoded><![CDATA[<p>Sleep puts a delay for a specified amount of time w/o a prompt. So you need to use read –p so that user can hit a key.</p> ]]></content:encoded> </item> <item><title>By: mne</title><link>http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-82396</link> <dc:creator>mne</dc:creator> <pubDate>Mon, 05 Mar 2007 10:41:41 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/linux-unix-pause-command.html#comment-82396</guid> <description>What about SLEEP command?</description> <content:encoded><![CDATA[<p>What about SLEEP command?</p> ]]></content:encoded> </item> </channel> </rss>
