<?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: split with FS a string (filesystem) in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/split-with-fs-a-string-filesystem/m-p/5503473#M640145</link>
    <description>&lt;P&gt;Something like this, perhaps?&lt;/P&gt;&lt;PRE&gt;#!/bin/sh
DBOWNER=oracle:dba
ROOTOWNER=root:sys

# set DEBUG="" to actually do the job, or
# DEBUG="echo" to just output what would be done
DEBUG=echo

while [ "$1" != "" ]
do
    DBDIR="$1"
    $DEBUG chown $DBOWNER $DBDIR

    PARENT=$(dirname $DBDIR)
    while [ "$PARENT" != "/" ]
    do
        $DEBUG chown $ROOTOWNER $PARENT
        PARENT=$(dirname $PARENT)
    done
    shift
done&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As is, the script will only display the commands it would run. First verify the script does what you want, then change the line 'DEBUG=echo' to 'DEBUG=""' to make it actually change the permissions instead of displaying the commands.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can run the script with one or many command-line arguments. For example, if you save the script as ./oraperms.sh and mark it executable:&lt;/P&gt;&lt;PRE&gt;$ ./oraperms.sh /mnt/db1/ORASID
or
$ ./oraperms.sh /mnt/db1/ORASID /mnt2/db2/OTHERSID /third/deep/dir/db3/THIRDSID
or
$ ./oraperms.sh /mnt/db*/*SID&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jan 2012 19:55:12 GMT</pubDate>
    <dc:creator>Matti_Kurkela</dc:creator>
    <dc:date>2012-01-20T19:55:12Z</dc:date>
    <item>
      <title>split with FS a string (filesystem )</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/split-with-fs-a-string-filesystem/m-p/5502141#M640142</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have a filesystem and subdirectories like /mnt/db1/ORASID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want to set dynamic for the mountpoint and db1 the user "root:sys" and only for dir ORASID the oracle user "oracle:dba":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/mnt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; user root:sys&lt;/P&gt;&lt;P&gt;/mnt/db1 &amp;nbsp;&amp;nbsp; user root:sys&lt;/P&gt;&lt;P&gt;/mnt/db1/ORASID&amp;nbsp; user oracle:dba&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is my version , i am not happy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2012 16:23:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/split-with-fs-a-string-filesystem/m-p/5502141#M640142</guid>
      <dc:creator>support_billa</dc:creator>
      <dc:date>2012-01-19T16:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: split with FS a string (filesystem)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/split-with-fs-a-string-filesystem/m-p/5502417#M640143</link>
      <description>&lt;P&gt;&amp;gt;i want to set dynamic for the mountpoint and db1 the user "root:sys" and only for dir ORASID the oracle user "oracle:dba":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure what you are trying to do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can optimize your script with:&lt;/P&gt;&lt;P&gt;&amp;nbsp; typeset -i i=0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;filesystem_split="${fs_split_ifs}""${filesystem[${i}]}"&lt;/P&gt;&lt;P&gt;&amp;gt;filesystem_split="${filesystem_split}""/""${filesystem[${i}]}"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure why you have stuttered quotes.&amp;nbsp; You just need the outer ones:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; filesystem_split="${filesystem_split}/${filesystem[${i}]}"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(You also don't need ${} within subscripts, [i] will work fine.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;i=$(( ${i} + 1 ))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can replace this by: (( i += 1 ))&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2012 20:56:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/split-with-fs-a-string-filesystem/m-p/5502417#M640143</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-01-19T20:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: split with FS a string (filesystem)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/split-with-fs-a-string-filesystem/m-p/5503069#M640144</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;better explanations : the last directory starting from root-directory "/" should get oracle user and permission , the other directories should get root :sys :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/mnt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; user root:sys&lt;/P&gt;&lt;P&gt;/mnt/db1 &amp;nbsp;&amp;nbsp; user root:sys&lt;/P&gt;&lt;P&gt;/mnt/db1/ORASID&amp;nbsp; user oracle:dba&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2012 12:40:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/split-with-fs-a-string-filesystem/m-p/5503069#M640144</guid>
      <dc:creator>support_billa</dc:creator>
      <dc:date>2012-01-20T12:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: split with FS a string (filesystem)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/split-with-fs-a-string-filesystem/m-p/5503473#M640145</link>
      <description>&lt;P&gt;Something like this, perhaps?&lt;/P&gt;&lt;PRE&gt;#!/bin/sh
DBOWNER=oracle:dba
ROOTOWNER=root:sys

# set DEBUG="" to actually do the job, or
# DEBUG="echo" to just output what would be done
DEBUG=echo

while [ "$1" != "" ]
do
    DBDIR="$1"
    $DEBUG chown $DBOWNER $DBDIR

    PARENT=$(dirname $DBDIR)
    while [ "$PARENT" != "/" ]
    do
        $DEBUG chown $ROOTOWNER $PARENT
        PARENT=$(dirname $PARENT)
    done
    shift
done&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As is, the script will only display the commands it would run. First verify the script does what you want, then change the line 'DEBUG=echo' to 'DEBUG=""' to make it actually change the permissions instead of displaying the commands.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can run the script with one or many command-line arguments. For example, if you save the script as ./oraperms.sh and mark it executable:&lt;/P&gt;&lt;PRE&gt;$ ./oraperms.sh /mnt/db1/ORASID
or
$ ./oraperms.sh /mnt/db1/ORASID /mnt2/db2/OTHERSID /third/deep/dir/db3/THIRDSID
or
$ ./oraperms.sh /mnt/db*/*SID&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2012 19:55:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/split-with-fs-a-string-filesystem/m-p/5503473#M640145</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2012-01-20T19:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: split with FS a string (filesystem)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/split-with-fs-a-string-filesystem/m-p/5503631#M640146</link>
      <description>&lt;P&gt;&amp;gt;here is my version, I am not happy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems to do its job.&amp;nbsp; What do you not like?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And you don't really need: fs_split_ifs="/"&lt;/P&gt;&lt;P&gt;Just always do:&lt;/P&gt;&lt;P&gt;filesystem_split="${filesystem_split}/${filesystem[i]}"&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2012 04:25:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/split-with-fs-a-string-filesystem/m-p/5503631#M640146</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-01-21T04:25:55Z</dc:date>
    </item>
  </channel>
</rss>

