<?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: command problem in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/command-problem/m-p/2957772#M76996</link>
    <description>1. either&lt;BR /&gt;   # . ./script_name&lt;BR /&gt;   or&lt;BR /&gt;   # exec ./script_name&lt;BR /&gt;&lt;BR /&gt;2. chattr +i file &lt;BR /&gt;&lt;BR /&gt;Now even root cannot delete file. Unless he also runs the command on that file and then tries rm again&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Trystan&lt;BR /&gt;</description>
    <pubDate>Thu, 24 Apr 2003 12:58:14 GMT</pubDate>
    <dc:creator>trystan macdonald_1</dc:creator>
    <dc:date>2003-04-24T12:58:14Z</dc:date>
    <item>
      <title>command problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/command-problem/m-p/2957768#M76992</link>
      <description>1. How to excute script without creating new subshell?&lt;BR /&gt;&lt;BR /&gt;2. How to prevent a file from being removed?</description>
      <pubDate>Wed, 23 Apr 2003 16:16:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/command-problem/m-p/2957768#M76992</guid>
      <dc:creator>neocosmic</dc:creator>
      <dc:date>2003-04-23T16:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: command problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/command-problem/m-p/2957769#M76993</link>
      <description>1.- If you are in bash shell with the dot command, but this is not a properly execution, is like if you type in the commands in the shell.&lt;BR /&gt;&lt;BR /&gt;$ . script.sh&lt;BR /&gt;&lt;BR /&gt;(dot space bar script name)&lt;BR /&gt;&lt;BR /&gt;2.- You can do it in two ways&lt;BR /&gt;a) chmod 444 file_name&lt;BR /&gt;   but with rm -f file_name, if you are the owner the file is removed anyway.&lt;BR /&gt;b) chmod 444 file_name and changing the owner of the file,&lt;BR /&gt;chown root.root file_name. But, at this way, you can't access the file anymore.&lt;BR /&gt;&lt;BR /&gt;Frank.</description>
      <pubDate>Wed, 23 Apr 2003 16:40:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/command-problem/m-p/2957769#M76993</guid>
      <dc:creator>Francisco J. Soler</dc:creator>
      <dc:date>2003-04-23T16:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: command problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/command-problem/m-p/2957770#M76994</link>
      <description>You can use the exec command to replace your current shell with the specified command, instead of spawning a sub-shell to run the command.  This will cause your session to exit once the command completes.&lt;BR /&gt;&lt;BR /&gt;If you're talking about shell scripts only, your can source the script file with the . command, e.g.&lt;BR /&gt;&lt;BR /&gt;. /path/to/script&lt;BR /&gt;&lt;BR /&gt;Keep in mind that, if your shell script executes an exit command,  your session will be terminated, just as if you had used the exec command.  In this case, replace exit with return.</description>
      <pubDate>Wed, 23 Apr 2003 16:48:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/command-problem/m-p/2957770#M76994</guid>
      <dc:creator>Bill Douglass</dc:creator>
      <dc:date>2003-04-23T16:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: command problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/command-problem/m-p/2957771#M76995</link>
      <description>As the 1st question has been answered, I won't re-hash.&lt;BR /&gt;&lt;BR /&gt;The 2nd answer however, there are a number of solutions, depending on how much you want the file to stay.&lt;BR /&gt;&lt;BR /&gt;The method Francisco should be fine if you don't want to protect the file from it's owner.&lt;BR /&gt;&lt;BR /&gt;If you want further protection, you can use 'chattr'.&lt;BR /&gt;&lt;BR /&gt;One of the flags you can give files are 'i' (immutable).&lt;BR /&gt;&lt;BR /&gt;This might be more protection than you want however.  From the man page of 'chattr':&lt;BR /&gt;&lt;BR /&gt;A  file with the `i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file  and  no  data  can  be written  to  the  file.  Only  the  superuser  can  set  or  clear this attribute.&lt;BR /&gt;&lt;BR /&gt;.. Just another option for you.</description>
      <pubDate>Wed, 23 Apr 2003 22:16:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/command-problem/m-p/2957771#M76995</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2003-04-23T22:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: command problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/command-problem/m-p/2957772#M76996</link>
      <description>1. either&lt;BR /&gt;   # . ./script_name&lt;BR /&gt;   or&lt;BR /&gt;   # exec ./script_name&lt;BR /&gt;&lt;BR /&gt;2. chattr +i file &lt;BR /&gt;&lt;BR /&gt;Now even root cannot delete file. Unless he also runs the command on that file and then tries rm again&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Trystan&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Apr 2003 12:58:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/command-problem/m-p/2957772#M76996</guid>
      <dc:creator>trystan macdonald_1</dc:creator>
      <dc:date>2003-04-24T12:58:14Z</dc:date>
    </item>
  </channel>
</rss>

