<?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: Input Parameters in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918988#M104166</link>
    <description>try &lt;BR /&gt;&lt;BR /&gt;# file -h file1 file2&lt;BR /&gt;&lt;BR /&gt;Is this, what you want?&lt;BR /&gt;&lt;BR /&gt;HTH!</description>
    <pubDate>Wed, 17 Aug 2005 11:56:36 GMT</pubDate>
    <dc:creator>Torsten.</dc:creator>
    <dc:date>2005-08-17T11:56:36Z</dc:date>
    <item>
      <title>Input Parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918986#M104164</link>
      <description>Hello Folks,&lt;BR /&gt;&lt;BR /&gt;I'm a newbie at scripting and I'm trying to write a script that will examine each argument passed and report whether the argument is a directory, link, other or does not exist.  If no arguments are passed I want to print out the usage statement.&lt;BR /&gt;&lt;BR /&gt;All I have at this point is:&lt;BR /&gt;&lt;BR /&gt;USAGE="usage:param.ksh arg1 arg2 arg3"&lt;BR /&gt;&lt;BR /&gt;I am litterally drawing a blank.  Any guidence would be much appreciated.&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;diesel</description>
      <pubDate>Wed, 17 Aug 2005 11:46:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918986#M104164</guid>
      <dc:creator>Diesel</dc:creator>
      <dc:date>2005-08-17T11:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: Input Parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918987#M104165</link>
      <description>if [ $# -ne 1 ]&lt;BR /&gt;then&lt;BR /&gt;    echo "USAGE=param.ksh arg1 arg2 arg3"&lt;BR /&gt;    exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;That gives you your usage.  Then you can go on to test the args using $1 $2 $3, etc.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 17 Aug 2005 11:54:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918987#M104165</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2005-08-17T11:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Input Parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918988#M104166</link>
      <description>try &lt;BR /&gt;&lt;BR /&gt;# file -h file1 file2&lt;BR /&gt;&lt;BR /&gt;Is this, what you want?&lt;BR /&gt;&lt;BR /&gt;HTH!</description>
      <pubDate>Wed, 17 Aug 2005 11:56:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918988#M104166</guid>
      <dc:creator>Torsten.</dc:creator>
      <dc:date>2005-08-17T11:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Input Parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918989#M104167</link>
      <description>just to test:&lt;BR /&gt;&lt;BR /&gt;# file -h `ls`</description>
      <pubDate>Wed, 17 Aug 2005 11:58:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918989#M104167</guid>
      <dc:creator>Torsten.</dc:creator>
      <dc:date>2005-08-17T11:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Input Parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918990#M104168</link>
      <description>Something like this should get you started:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh  &lt;BR /&gt;&lt;BR /&gt;typeset PROG=${0}&lt;BR /&gt;typeset -i STAT=0&lt;BR /&gt;&lt;BR /&gt;if [[ ${#} -ge 1 ]]&lt;BR /&gt;  then&lt;BR /&gt;    while [[ ${#} -ge 1 ]]&lt;BR /&gt;       do&lt;BR /&gt;          typeset F=${1}&lt;BR /&gt;          shift&lt;BR /&gt;          echo "${F} \c"&lt;BR /&gt;          if [[ -e "${F}" ]]&lt;BR /&gt;            then&lt;BR /&gt;              if [[ -f "${F}" ]]&lt;BR /&gt;                then&lt;BR /&gt;                  echo "regular file"&lt;BR /&gt;                fi&lt;BR /&gt;               if [[ -d "${F}" ]]&lt;BR /&gt;                 then&lt;BR /&gt;                   echo "directory"&lt;BR /&gt;                 fi&lt;BR /&gt;               if [[ -h "${F}" ]]&lt;BR /&gt;                 then&lt;BR /&gt;                   echo "symbolic link"&lt;BR /&gt;                 fi&lt;BR /&gt;            else&lt;BR /&gt;              echo "does not exist"&lt;BR /&gt;            fi&lt;BR /&gt;       done&lt;BR /&gt;  else&lt;BR /&gt;    echo "Usage: ${PROG} arg1 [arg2 ...]" &amp;gt;&amp;amp;2&lt;BR /&gt;    STAT=255&lt;BR /&gt;  fi&lt;BR /&gt;exit ${STAT}</description>
      <pubDate>Wed, 17 Aug 2005 11:59:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918990#M104168</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-08-17T11:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Input Parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918991#M104169</link>
      <description>I do it like Pete in a way:&lt;BR /&gt;&lt;BR /&gt;if [ $# -lt 1 -o \( $# -gt 1 -a $# -lt 4 \) ]&lt;BR /&gt;then&lt;BR /&gt;  echo "Usage:"&lt;BR /&gt;  echo "usermem \"userid\""&lt;BR /&gt;  echo "Example:"&lt;BR /&gt;  echo "usermem gwild"&lt;BR /&gt;  exit 1&lt;BR /&gt;fi&lt;BR /&gt;echo " "&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Wed, 17 Aug 2005 12:02:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918991#M104169</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2005-08-17T12:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: Input Parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918992#M104170</link>
      <description>Use the [[ -X item ]] operators (where X&lt;BR /&gt;is a,b,c,etc.) described in the sh-posix&lt;BR /&gt;man page.&lt;BR /&gt;&lt;BR /&gt;for item&lt;BR /&gt;  in $*&lt;BR /&gt;do&lt;BR /&gt;  [[ -f $item ]] &amp;amp;&amp;amp; echo "$item is a file"&lt;BR /&gt;  [[ -d $item ]] &amp;amp;&amp;amp; echo "$item is a dir"&lt;BR /&gt;  etc.&lt;BR /&gt;done</description>
      <pubDate>Wed, 17 Aug 2005 12:04:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918992#M104170</guid>
      <dc:creator>Gregory Fruth</dc:creator>
      <dc:date>2005-08-17T12:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: Input Parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918993#M104171</link>
      <description>Hey folks,&lt;BR /&gt;&lt;BR /&gt;I appreciate all your rapid responses.  All of you have something I can use so thank you so much.&lt;BR /&gt;&lt;BR /&gt;-diesel</description>
      <pubDate>Wed, 17 Aug 2005 12:06:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918993#M104171</guid>
      <dc:creator>Diesel</dc:creator>
      <dc:date>2005-08-17T12:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Input Parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918994#M104172</link>
      <description>Here's a start:&lt;BR /&gt; &lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;set -u&lt;BR /&gt;export PATH=/usr/bin&lt;BR /&gt;MYNAME=${0##*/}&lt;BR /&gt; &lt;BR /&gt;if [ $# -lt 1 ]&lt;BR /&gt;then&lt;BR /&gt; echo "\nUsage: $MYNAME arg1 [...arg2...]\n"&lt;BR /&gt; exit&lt;BR /&gt;fi&lt;BR /&gt; &lt;BR /&gt;# Now run through each parameter&lt;BR /&gt; &lt;BR /&gt;for MYARG in $@&lt;BR /&gt;do&lt;BR /&gt; if [ -f $MYARG ]&lt;BR /&gt; then&lt;BR /&gt; echo "$MYARG is a file"&lt;BR /&gt; elif [ -d $MYARG ]&lt;BR /&gt; then&lt;BR /&gt; echo "$MYARG is a directory"&lt;BR /&gt; elif  [ -h $MYARG ]&lt;BR /&gt; then&lt;BR /&gt; echo "$MYARG is a symbolic link"&lt;BR /&gt; else&lt;BR /&gt; echo "$MYARG does not exist or is some other filetype"&lt;BR /&gt; fi&lt;BR /&gt; shift&lt;BR /&gt;done&lt;BR /&gt; &lt;BR /&gt;Of course you can adjust the code to meet your needs.</description>
      <pubDate>Wed, 17 Aug 2005 12:15:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918994#M104172</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2005-08-17T12:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Input Parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918995#M104173</link>
      <description>Excellent Bill..thank you.&lt;BR /&gt;&lt;BR /&gt;These forums are great!! &lt;BR /&gt;&lt;BR /&gt;-diesel</description>
      <pubDate>Wed, 17 Aug 2005 12:27:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918995#M104173</guid>
      <dc:creator>Diesel</dc:creator>
      <dc:date>2005-08-17T12:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Input Parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918996#M104174</link>
      <description>Thanks to all of you who responded.  You have been most helpful and I really appreciate the sharing of knowledge.&lt;BR /&gt;&lt;BR /&gt;Have a great day....</description>
      <pubDate>Wed, 17 Aug 2005 12:30:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/input-parameters/m-p/4918996#M104174</guid>
      <dc:creator>Diesel</dc:creator>
      <dc:date>2005-08-17T12:30:44Z</dc:date>
    </item>
  </channel>
</rss>

