<?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 for file type in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-for-file-type/m-p/3478194#M704367</link>
    <description>Personally, I'd go with the "case" example in this case (:o)&lt;BR /&gt;but if you do decide to go with "if", don't forget the "else"!&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;if [[ $vcsfile_suffix = ".qks" ]]&lt;BR /&gt;then&lt;BR /&gt;qd $vcsfile&lt;BR /&gt;&lt;BR /&gt;else&lt;BR /&gt;&lt;BR /&gt;if [[ $vcsfile_suffix = ".cob" ]]&lt;BR /&gt;then&lt;BR /&gt;sc_cobcomp $vcsfile&lt;BR /&gt;...&lt;BR /&gt;fi&lt;BR /&gt;</description>
    <pubDate>Fri, 04 Feb 2005 04:52:13 GMT</pubDate>
    <dc:creator>Gordon  Morrison</dc:creator>
    <dc:date>2005-02-04T04:52:13Z</dc:date>
    <item>
      <title>Checking for file type</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-for-file-type/m-p/3478191#M704364</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;I am using a change management system that makes available a variable called $vcsfile (this is the name of the file(s) being moved from location to location) and $vcsfile_suffix (this the file extension of the file(s) being moved from location to location).&lt;BR /&gt;&lt;BR /&gt;I am struggling with how to construct the logic to execute one command versus another based on the file extension.&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;if $vcsfile_suffix = .qks&lt;BR /&gt;then&lt;BR /&gt;qd $vcsfile&lt;BR /&gt;if $vcsfile_suffix = .cob&lt;BR /&gt;then&lt;BR /&gt;sc_cobcomp $vcsfile&lt;BR /&gt;...&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;I see the commands but not exactly sure how to string them all together for it to work ...&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for any help.&lt;BR /&gt;&lt;BR /&gt;Jeff&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Feb 2005 17:42:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-for-file-type/m-p/3478191#M704364</guid>
      <dc:creator>Jeff Crump</dc:creator>
      <dc:date>2005-02-03T17:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for file type</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-for-file-type/m-p/3478192#M704365</link>
      <description>if [ "$vcsfile_suffix" = ".qks" ]&lt;BR /&gt;then&lt;BR /&gt;qd $vcsfile&lt;BR /&gt;&lt;BR /&gt;if [ "$vcsfile_suffix" = ".cob"&lt;BR /&gt;then&lt;BR /&gt;sc_cobcomp $vcsfile&lt;BR /&gt;...&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Note on getting the filessuffix.&lt;BR /&gt;&lt;BR /&gt;Lets say the names are all two part:&lt;BR /&gt;&lt;BR /&gt;something.qks&lt;BR /&gt;something.cob&lt;BR /&gt;&lt;BR /&gt;extention = $(ls $filename | awk -F. '{print $2}')&lt;BR /&gt;vcsfile_suffix=$extension}&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Feb 2005 17:48:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-for-file-type/m-p/3478192#M704365</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-02-03T17:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for file type</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-for-file-type/m-p/3478193#M704366</link>
      <description>don't know exactly which shell,etc your using, but this is a pretty good suggestion&lt;BR /&gt;&lt;BR /&gt;case "$vcsfile_suffix" in&lt;BR /&gt;".qks") qd $vcsfile;;&lt;BR /&gt;".cob") sc_cobcomp $vcsfile;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Feb 2005 17:49:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-for-file-type/m-p/3478193#M704366</guid>
      <dc:creator>c_51</dc:creator>
      <dc:date>2005-02-03T17:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for file type</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-for-file-type/m-p/3478194#M704367</link>
      <description>Personally, I'd go with the "case" example in this case (:o)&lt;BR /&gt;but if you do decide to go with "if", don't forget the "else"!&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;if [[ $vcsfile_suffix = ".qks" ]]&lt;BR /&gt;then&lt;BR /&gt;qd $vcsfile&lt;BR /&gt;&lt;BR /&gt;else&lt;BR /&gt;&lt;BR /&gt;if [[ $vcsfile_suffix = ".cob" ]]&lt;BR /&gt;then&lt;BR /&gt;sc_cobcomp $vcsfile&lt;BR /&gt;...&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Feb 2005 04:52:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-for-file-type/m-p/3478194#M704367</guid>
      <dc:creator>Gordon  Morrison</dc:creator>
      <dc:date>2005-02-04T04:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for file type</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-for-file-type/m-p/3478195#M704368</link>
      <description>Jeff,&lt;BR /&gt;not sure this adds anything to the "case" solution but:&lt;BR /&gt;basename &lt;FILENAME.SUFF&gt; | cut -d'.' -f2&lt;BR /&gt;will get you the suffix of filename ;-)&lt;BR /&gt;Regards&lt;/FILENAME.SUFF&gt;</description>
      <pubDate>Fri, 04 Feb 2005 05:00:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-for-file-type/m-p/3478195#M704368</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-02-04T05:00:46Z</dc:date>
    </item>
  </channel>
</rss>

