<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Checking the null entry in Shell Scripting in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053457#M93570</link>
    <description>thank you very much to all for helping me to find  solution</description>
    <pubDate>Mon, 18 Jun 2007 07:27:32 GMT</pubDate>
    <dc:creator>CA1490051</dc:creator>
    <dc:date>2007-06-18T07:27:32Z</dc:date>
    <item>
      <title>Checking the null entry in Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053452#M93565</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;    I am trying to write a script for different options the user enters.&lt;BR /&gt;&lt;BR /&gt;    the small snippet is as follows&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;read Choice&lt;BR /&gt;&lt;BR /&gt;if [ $Choice -eq 1 ]&lt;BR /&gt;then&lt;BR /&gt;     ...............&lt;BR /&gt;else&lt;BR /&gt;    ................&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Now the problem is i also want to check for the   null i.e, if the user enters nothing in the console and presses enter. &lt;BR /&gt;&lt;BR /&gt;     How can i check this null in the script .&lt;BR /&gt;&lt;BR /&gt;thanks in advance&lt;BR /&gt;Vikram&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Jun 2007 06:57:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053452#M93565</guid>
      <dc:creator>CA1490051</dc:creator>
      <dc:date>2007-06-18T06:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Checking the null entry in Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053453#M93566</link>
      <description>Hey&lt;BR /&gt;&lt;BR /&gt;if [[ $# -eq 0 ]]&lt;BR /&gt;then&lt;BR /&gt; echo no arguments&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Mon, 18 Jun 2007 07:05:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053453#M93566</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-06-18T07:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: Checking the null entry in Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053454#M93567</link>
      <description>&lt;!--!*#--&gt;Hi:&lt;BR /&gt;&lt;BR /&gt;read REPLY&lt;BR /&gt;case ${REPLY} in&lt;BR /&gt;0  ) echo "..."&lt;BR /&gt;;;&lt;BR /&gt;1  ) echo "..."&lt;BR /&gt;;;&lt;BR /&gt;"" ) echo "please enter something!"&lt;BR /&gt;;;&lt;BR /&gt;*  ) echo "error!"&lt;BR /&gt;;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 18 Jun 2007 07:09:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053454#M93567</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-06-18T07:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Checking the null entry in Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053455#M93568</link>
      <description>Hi,&lt;BR /&gt; &lt;BR /&gt;But i think you are talking about command line arguments.&lt;BR /&gt;  &lt;BR /&gt;   the problem  i am facing is with scanning the values using "read"&lt;BR /&gt;&lt;BR /&gt;      &lt;BR /&gt; i have written like this&lt;BR /&gt; &lt;BR /&gt;read Choice&lt;BR /&gt;   if [ $Choice -eq 1 ] || [ -z $Choice ]&lt;BR /&gt;         ...........&lt;BR /&gt;&lt;BR /&gt;   fi &lt;BR /&gt;&lt;BR /&gt; if i try to run the script and give enter in the console i.e null string it says &lt;BR /&gt;"Specify a parameter with this command"&lt;BR /&gt;&lt;BR /&gt; But i think i have checked for the null also .&lt;BR /&gt;&lt;BR /&gt;I am not understanding what should i do to satisfy the above if condition.</description>
      <pubDate>Mon, 18 Jun 2007 07:14:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053455#M93568</guid>
      <dc:creator>CA1490051</dc:creator>
      <dc:date>2007-06-18T07:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: Checking the null entry in Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053456#M93569</link>
      <description>If you don't use parameters but want your script to be interactive you could do it the following way:&lt;BR /&gt;&lt;BR /&gt;read input&lt;BR /&gt;&lt;BR /&gt;if [ -z "$input" ]; then&lt;BR /&gt;  # zero/empty input&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Jun 2007 07:15:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053456#M93569</guid>
      <dc:creator>Bernd Reize</dc:creator>
      <dc:date>2007-06-18T07:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: Checking the null entry in Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053457#M93570</link>
      <description>thank you very much to all for helping me to find  solution</description>
      <pubDate>Mon, 18 Jun 2007 07:27:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053457#M93570</guid>
      <dc:creator>CA1490051</dc:creator>
      <dc:date>2007-06-18T07:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Checking the null entry in Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053458#M93571</link>
      <description>Always use double quotes when expanding variables that contain user input!&lt;BR /&gt;&lt;BR /&gt;The user might type something strange, like ";cat /etc/passwd;".&lt;BR /&gt;&lt;BR /&gt;This allows the user to by-pass the menu system and run commands directly. If the script is run as root (using a "setuid root" wrapper program or sudo), this gives the user a way to run any commands with unlimited access.&lt;BR /&gt;&lt;BR /&gt;Even if this script is not security-critical, it's good to make a habit of always using quotes. It makes your scripts more robust and this way you're less likely to make dangerous mistakes elsewhere.&lt;BR /&gt;&lt;BR /&gt;MK</description>
      <pubDate>Mon, 18 Jun 2007 07:59:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053458#M93571</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2007-06-18T07:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Checking the null entry in Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053459#M93572</link>
      <description>You can also check for null strings like:&lt;BR /&gt;$ if [ "$Choice" = "" ]; then</description>
      <pubDate>Mon, 18 Jun 2007 08:05:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-the-null-entry-in-shell-scripting/m-p/5053459#M93572</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-18T08:05:26Z</dc:date>
    </item>
  </channel>
</rss>

