<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Tech-Recipes - Latest Comments in Hide password entry in Bourne/bash shell script</title><link>http://tech-recipes.disqus.com/</link><description>Cookbook of Tech Tutorials</description><atom:link href="https://tech-recipes.disqus.com/hide_password_entry_in_bournebash_shell_script_bourne_shell_scripting_tech_recipes/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 14 Dec 2005 03:51:27 -0000</lastBuildDate><item><title>Re: Hide password entry in Bourne/bash shell script</title><link>http://www.tech-recipes.com/rx/278/hide-password-entry-in-bournebash-shell-script/#comment-2767255</link><description>&lt;p&gt;One more thing (OS and shell-dependent):&lt;br&gt;use closing redirection in the stty command:&lt;br&gt; stty -echo &amp;gt;&amp;amp;- 2&amp;gt;&amp;amp;-&lt;/p&gt;&lt;p&gt;This helps to avoid obsolete "No terminal" message in the scripts.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Wed, 14 Dec 2005 03:51:27 -0000</pubDate></item><item><title>Re: Hide password entry in Bourne/bash shell script</title><link>http://www.tech-recipes.com/rx/278/hide-password-entry-in-bournebash-shell-script/#comment-2767254</link><description>&lt;p&gt;Awesome!  I've never used trap before, but I'll be using it from now on.  That's a great solution to a very annoying problem.  Thanks for sharing!  Use of the trap command would make a great recipe..&lt;/p&gt;&lt;p&gt;Q&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">qmchenry</dc:creator><pubDate>Wed, 14 Dec 2005 03:48:52 -0000</pubDate></item><item><title>Re: Hide password entry in Bourne/bash shell script</title><link>http://www.tech-recipes.com/rx/278/hide-password-entry-in-bournebash-shell-script/#comment-2767253</link><description>&lt;p&gt;I also add the protection for the interruptions:&lt;/p&gt;&lt;p&gt;trap "stty echo ; exit" 1 2 15&lt;br&gt;stty -echo&lt;br&gt;read password&lt;br&gt;stty echo&lt;br&gt;trap "" 1 2 15&lt;/p&gt;&lt;p&gt;If the user press Ctrl+C in the password prompt, the normal stty mode will be restored&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">sttyecho</dc:creator><pubDate>Wed, 14 Dec 2005 03:43:39 -0000</pubDate></item><item><title>Re: Hide password entry in Bourne/bash shell script</title><link>http://www.tech-recipes.com/rx/278/hide-password-entry-in-bournebash-shell-script/#comment-2767252</link><description>&lt;p&gt;Neat trick!  Beware that this is OS dependent.  It works on all the Linux flavors I've tried but not a Solaris 8 system.  If you are writing a script to run on many platforms, the old school method above may be more generic.  But if writing a script for a specific system, this is a much slicker method.  Thanks for sharing!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">qmchenry</dc:creator><pubDate>Wed, 27 Oct 2004 06:44:49 -0000</pubDate></item><item><title>Re: Hide password entry in Bourne/bash shell script</title><link>http://www.tech-recipes.com/rx/278/hide-password-entry-in-bournebash-shell-script/#comment-2767251</link><description>&lt;p&gt;instead you can use -s option with read to hide the value like password&lt;/p&gt;&lt;p&gt;read -s secret&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Wed, 27 Oct 2004 02:30:43 -0000</pubDate></item></channel></rss>