<?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 Aliases for values in Shell Scripts in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838917#M272986</link>
    <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Is there such a thing as designating aliases for values in a shell script. for example:&lt;BR /&gt;&lt;BR /&gt;echo "do you want to..."&lt;BR /&gt;read variable&lt;BR /&gt;case $variable in&lt;BR /&gt;  y )do_command&lt;BR /&gt;    ;;&lt;BR /&gt;  n )do_other_command&lt;BR /&gt;    ;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;Now suppose that I want to do_command also if variable equals Y, yes, ok, or "" (return)?&lt;BR /&gt;&lt;BR /&gt;Is there a way to declare all these values equal to each other (especially globally), so I don't have to redundantly list each possibility, or have a long string of "OR"s in an if statement?</description>
    <pubDate>Mon, 07 Aug 2006 20:35:11 GMT</pubDate>
    <dc:creator>Allasso</dc:creator>
    <dc:date>2006-08-07T20:35:11Z</dc:date>
    <item>
      <title>Aliases for values in Shell Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838917#M272986</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Is there such a thing as designating aliases for values in a shell script. for example:&lt;BR /&gt;&lt;BR /&gt;echo "do you want to..."&lt;BR /&gt;read variable&lt;BR /&gt;case $variable in&lt;BR /&gt;  y )do_command&lt;BR /&gt;    ;;&lt;BR /&gt;  n )do_other_command&lt;BR /&gt;    ;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;Now suppose that I want to do_command also if variable equals Y, yes, ok, or "" (return)?&lt;BR /&gt;&lt;BR /&gt;Is there a way to declare all these values equal to each other (especially globally), so I don't have to redundantly list each possibility, or have a long string of "OR"s in an if statement?</description>
      <pubDate>Mon, 07 Aug 2006 20:35:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838917#M272986</guid>
      <dc:creator>Allasso</dc:creator>
      <dc:date>2006-08-07T20:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Aliases for values in Shell Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838918#M272987</link>
      <description>&lt;!--!*#--&gt;You can do this in your case statement.  A '|' (pipe symbol) between values means do a 'logical or' (a or b = a|b ).&lt;BR /&gt;&lt;BR /&gt;I would also check the $variable and if it is blank, then set it to yes if that is your default.&lt;BR /&gt;&lt;BR /&gt;if [[ "${variable}" = "" ]] ; then&lt;BR /&gt;  variable=y&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;case $variable in&lt;BR /&gt;  y|Y|yes|Yes|YES|OK|ok) do_command ;;&lt;BR /&gt;&lt;BR /&gt;  n|N|No|NO) do_other_command ;;&lt;BR /&gt;&lt;BR /&gt;  *) error ;;&lt;BR /&gt;&lt;BR /&gt;esac</description>
      <pubDate>Mon, 07 Aug 2006 20:41:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838918#M272987</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2006-08-07T20:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Aliases for values in Shell Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838919#M272988</link>
      <description>case $variable in&lt;BR /&gt;y|Y|yes|Yes|ok|OK) do_command&lt;BR /&gt;;;&lt;BR /&gt;&lt;BR /&gt;but you can make your task much easier by forcing the variable to lowercase:&lt;BR /&gt;&lt;BR /&gt;typeset -l lcvar=""&lt;BR /&gt;typeset variable=""&lt;BR /&gt;read variable&lt;BR /&gt;lvcar=${variable) # convert to lowercase&lt;BR /&gt;case ${lcvar} in&lt;BR /&gt;y|yes|okay|ok) do_command;;&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Aug 2006 20:47:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838919#M272988</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-07T20:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Aliases for values in Shell Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838920#M272989</link>
      <description>Oh, Thank You both!&lt;BR /&gt;&lt;BR /&gt;There seems to be a LOT of different little nuances in this stuff. There are a lot of pages and tutorials out there, but they each seem to cover real basic stuff, or little nips and tucks here and there.&lt;BR /&gt;&lt;BR /&gt;If you can recommend a good, comprehensive tutorial, especially one covering bash, I would be very happy.</description>
      <pubDate>Tue, 08 Aug 2006 08:30:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838920#M272989</guid>
      <dc:creator>Allasso</dc:creator>
      <dc:date>2006-08-08T08:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Aliases for values in Shell Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838921#M272990</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;This isn't exacatly a tutorial, but its an excellent guide:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.gnu.org/software/bash/manual/bash.html" target="_blank"&gt;http://www.gnu.org/software/bash/manual/bash.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 08 Aug 2006 08:33:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838921#M272990</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-08-08T08:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Aliases for values in Shell Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838922#M272991</link>
      <description>thanks, James. I've only scanned it, but it looks good so far.</description>
      <pubDate>Tue, 08 Aug 2006 08:40:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838922#M272991</guid>
      <dc:creator>Allasso</dc:creator>
      <dc:date>2006-08-08T08:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: Aliases for values in Shell Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838923#M272992</link>
      <description>Here's another excellent site for bash scripting:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.tldp.org/LDP/abs/html/" target="_blank"&gt;http://www.tldp.org/LDP/abs/html/&lt;/A&gt;</description>
      <pubDate>Tue, 08 Aug 2006 12:49:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838923#M272992</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-08-08T12:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Aliases for values in Shell Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838924#M272993</link>
      <description>thanks guys, these both are really good and comprehensive.</description>
      <pubDate>Thu, 10 Aug 2006 21:04:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/aliases-for-values-in-shell-scripts/m-p/3838924#M272993</guid>
      <dc:creator>Allasso</dc:creator>
      <dc:date>2006-08-10T21:04:02Z</dc:date>
    </item>
  </channel>
</rss>

