<?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: Shell Script to get user input</title>
	<atom:link href="http://www.thelinuxblog.com/shell-script-get-user-input/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thelinuxblog.com/shell-script-get-user-input/</link>
	<description>The Linux Blog, General Linux, Shell Scripts</description>
	<lastBuildDate>Tue, 27 Jul 2010 03:50:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: MBN</title>
		<link>http://www.thelinuxblog.com/shell-script-get-user-input/comment-page-1/#comment-1184</link>
		<dc:creator>MBN</dc:creator>
		<pubDate>Mon, 13 Oct 2008 12:56:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/shell-script-get-user-input/#comment-1184</guid>
		<description>Oh and this is the not out put which for a newbie don&#039;t look to good :(


: command not found
Please enter a users name and press [ENTER] :
: command not found
taskb.sh line 31: syntax error near unexpected token `fi&#039;
taskb.sh line 31: `fi&#039;</description>
		<content:encoded><![CDATA[<p>Oh and this is the not out put which for a newbie don&#8217;t look to good :(</p>
<p>: command not found<br />
Please enter a users name and press [ENTER] :<br />
: command not found<br />
taskb.sh line 31: syntax error near unexpected token `fi&#8217;<br />
taskb.sh line 31: `fi&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MBN</title>
		<link>http://www.thelinuxblog.com/shell-script-get-user-input/comment-page-1/#comment-1183</link>
		<dc:creator>MBN</dc:creator>
		<pubDate>Mon, 13 Oct 2008 12:50:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/shell-script-get-user-input/#comment-1183</guid>
		<description>Still a little bit lost :( 

This is what i&#039;m trying to do and my code that&#039;s all $%^ up

I&#039;m trying to get a user to enter another users name which in turn checks to see if that users home folder exists.

&lt;code&gt;#!/bin/bash

cd /home

echo &quot;Please enter a users name and press [Enter]&quot;;

while read username

do

blank=&quot;$username&quot;

echo $blank;

if [ -z &quot;${blank}&quot; ]; then

echo &quot;That was empty, Please try again&quot;

else

echo &quot;Checking now . . . . &quot;

fi

done

if [ -d $username ]; then

echo &quot;That user exists&quot;

else

echo &quot;No such user&quot;  # am I able to loop this back up to the top for user to enter user name?

fi&lt;/code&gt;

Sorry about the shocking coding i&#039;m still trying to learn</description>
		<content:encoded><![CDATA[<p>Still a little bit lost :( </p>
<p>This is what i&#8217;m trying to do and my code that&#8217;s all $%^ up</p>
<p>I&#8217;m trying to get a user to enter another users name which in turn checks to see if that users home folder exists.</p>
<p><code>#!/bin/bash</p>
<p>cd /home</p>
<p>echo "Please enter a users name and press [Enter]";</p>
<p>while read username</p>
<p>do</p>
<p>blank="$username"</p>
<p>echo $blank;</p>
<p>if [ -z "${blank}" ]; then</p>
<p>echo "That was empty, Please try again"</p>
<p>else</p>
<p>echo "Checking now . . . . "</p>
<p>fi</p>
<p>done</p>
<p>if [ -d $username ]; then</p>
<p>echo "That user exists"</p>
<p>else</p>
<p>echo "No such user"  # am I able to loop this back up to the top for user to enter user name?</p>
<p>fi</code></p>
<p>Sorry about the shocking coding i&#8217;m still trying to learn</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TheLinuxBlog.com</title>
		<link>http://www.thelinuxblog.com/shell-script-get-user-input/comment-page-1/#comment-1176</link>
		<dc:creator>TheLinuxBlog.com</dc:creator>
		<pubDate>Fri, 10 Oct 2008 13:23:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/shell-script-get-user-input/#comment-1176</guid>
		<description>@MBN the -z string returns True if the length of string is zero. 
Currently, if the user types an empty string, or nothing the script exits.
Removing -z in the if statement will exit if the user types something in.

Hope this helps, 

- Owen.</description>
		<content:encoded><![CDATA[<p>@MBN the -z string returns True if the length of string is zero.<br />
Currently, if the user types an empty string, or nothing the script exits.<br />
Removing -z in the if statement will exit if the user types something in.</p>
<p>Hope this helps, </p>
<p>- Owen.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MBN</title>
		<link>http://www.thelinuxblog.com/shell-script-get-user-input/comment-page-1/#comment-1171</link>
		<dc:creator>MBN</dc:creator>
		<pubDate>Fri, 10 Oct 2008 00:48:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/shell-script-get-user-input/#comment-1171</guid>
		<description>hiya

looked at your above script but i want to use it the oppersite way around... more to check that user input is not blank?</description>
		<content:encoded><![CDATA[<p>hiya</p>
<p>looked at your above script but i want to use it the oppersite way around&#8230; more to check that user input is not blank?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Linux Blog &#187; tweeting from the command line</title>
		<link>http://www.thelinuxblog.com/shell-script-get-user-input/comment-page-1/#comment-739</link>
		<dc:creator>The Linux Blog &#187; tweeting from the command line</dc:creator>
		<pubDate>Sun, 29 Jun 2008 17:25:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/shell-script-get-user-input/#comment-739</guid>
		<description>[...] If you&#8217;d like more information on how this works read this article: Shell Script to get user input [...]</description>
		<content:encoded><![CDATA[<p>[...] If you&#8217;d like more information on how this works read this article: Shell Script to get user input [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Owen</title>
		<link>http://www.thelinuxblog.com/shell-script-get-user-input/comment-page-1/#comment-373</link>
		<dc:creator>Owen</dc:creator>
		<pubDate>Fri, 29 Feb 2008 16:44:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/shell-script-get-user-input/#comment-373</guid>
		<description>Phani, 

Try this script: &lt;a href=&quot;uploads/input.sh&quot; rel=&quot;nofollow&quot;&gt;input.sh&lt;/a&gt; It should exit the loop with no problem.</description>
		<content:encoded><![CDATA[<p>Phani, </p>
<p>Try this script: <a href="uploads/input.sh" rel="nofollow">input.sh</a> It should exit the loop with no problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phani</title>
		<link>http://www.thelinuxblog.com/shell-script-get-user-input/comment-page-1/#comment-372</link>
		<dc:creator>Phani</dc:creator>
		<pubDate>Thu, 28 Feb 2008 23:49:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/shell-script-get-user-input/#comment-372</guid>
		<description>Thanks Owen
But its not working, the loop is not ending and the input is not passing to the variable.

Any help is much appreciated.

Thanks,
Phani.</description>
		<content:encoded><![CDATA[<p>Thanks Owen<br />
But its not working, the loop is not ending and the input is not passing to the variable.</p>
<p>Any help is much appreciated.</p>
<p>Thanks,<br />
Phani.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Owen</title>
		<link>http://www.thelinuxblog.com/shell-script-get-user-input/comment-page-1/#comment-371</link>
		<dc:creator>Owen</dc:creator>
		<pubDate>Thu, 28 Feb 2008 18:20:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/shell-script-get-user-input/#comment-371</guid>
		<description>Hi Phani,

This should work:

while read inputline
do
        what=&quot;$inputline&quot;
done

echo $what

Hope this helps, Owen.</description>
		<content:encoded><![CDATA[<p>Hi Phani,</p>
<p>This should work:</p>
<p>while read inputline<br />
do<br />
        what=&#8221;$inputline&#8221;<br />
done</p>
<p>echo $what</p>
<p>Hope this helps, Owen.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phani</title>
		<link>http://www.thelinuxblog.com/shell-script-get-user-input/comment-page-1/#comment-370</link>
		<dc:creator>Phani</dc:creator>
		<pubDate>Thu, 28 Feb 2008 05:55:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/shell-script-get-user-input/#comment-370</guid>
		<description>Hi Owen

I am trying to export the user input to a variable. I did used the example provided by you, but the loop is never ending. I want to stop the loop once the user has entered his input, so that I can export that input to another variable which can be used for other script.

Kindly help by any suggestion in achieving this task.

Thanks,
Phani.</description>
		<content:encoded><![CDATA[<p>Hi Owen</p>
<p>I am trying to export the user input to a variable. I did used the example provided by you, but the loop is never ending. I want to stop the loop once the user has entered his input, so that I can export that input to another variable which can be used for other script.</p>
<p>Kindly help by any suggestion in achieving this task.</p>
<p>Thanks,<br />
Phani.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Owen</title>
		<link>http://www.thelinuxblog.com/shell-script-get-user-input/comment-page-1/#comment-302</link>
		<dc:creator>Owen</dc:creator>
		<pubDate>Thu, 07 Feb 2008 22:13:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/shell-script-get-user-input/#comment-302</guid>
		<description>All right, Maybe change the run level to multi user no X. This time see if once its done you can just run the command startx.</description>
		<content:encoded><![CDATA[<p>All right, Maybe change the run level to multi user no X. This time see if once its done you can just run the command startx.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
