Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How do properties effect script? Post 302077318 by blowtorch on Wednesday 21st of June 2006 06:23:11 AM
Old 06-21-2006
To be honest, I was surprised to find that the -f and -i options work together. But on checking the man page (on HP and Sun), I found the following:
On HP-UX:
HTML Code:
rm recognizes the following options:

           -f   Force each file or directory to be removed without prompting
                for confirmation, regardless of the permissions of the
                entry.  This option also suppresses diagnostic messages
                regarding nonexistent operands.

                This option does not suppress any diagnostic messages other
                than those regarding nonexistent operands.  To suppress all
                error message and interactive prompts, the -f option should
                be used while redirecting standard error output to
                /dev/null.

                This option ignores any previous occurrence of the -i
                option.

 Hewlett-Packard Company            - 1 -   HP-UX Release 11i: November 2000

 rm(1)                                                                 rm(1)

           -i   Write a prompt to standard error requesting confirmation
                before removing each entry.
On Solaris:
HTML Code:
    -f    Removes all files (whether write-protected or not)  in
           a  directory  without  prompting the user. In a write-
           protected directory, however, files are never  removed
           (whatever  their permissions are), but no messages are
           displayed. If the removal of a write-protected  direc-
           tory  is  attempted,  this option will not suppress an
           error message.

     -i    Interactive. With this option, rm prompts for  confir-
           mation  before removing any files. It overrides the -f
           option and remains in  effect  even  if  the  standard
           input is not a terminal.
So if you run "rm -fi" on HP, it is interactive, but "rm -if" is forced as specified in the man page. But on Solaris, if "-i" is specified, then the "-f" is ignored regardless of where it occurs.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

recursive effect!!

I run the following command in some of my folders... and ended up with a huge mess!! find . -type f -exec perl -e 's/blabla/zzzxxxx/gi' -p -i.bak {} \; I had to kill the process and later when I checked with one of my folders.. ls vaditerm.dt.bak vaditerm.dt.bak.bak... (2 Replies)
Discussion started by: sskb
2 Replies

2. UNIX for Advanced & Expert Users

Effect of Preemptive Kernel

hi there, i am porting kernel 2.2 driver program to kernel 2.6. for some extent i am successfull but some times the system gets hanged. what might be the problem? i am not able to get any help from log messages as nothing is being printed at that moment. hey does this kernel preemptiveness and... (2 Replies)
Discussion started by: sriram.ec
2 Replies

3. Solaris

will this script in crontab effect SUN 9??

Hi all, I work in Sun Solaris 9. I am plan to put the following script(remove90dysOldrfiles.sh) in CRONTAB for removing huge huge number of files those are older than 90 days from different directory. In the Crontab i will set the time for everymidnight it will search 90days older file and... (2 Replies)
Discussion started by: thepurple
2 Replies

4. Virtualization and Cloud Computing

The Network Effect - Part 1

2008-10-31T22:46:14+01:00 http://geekandpoke.typepad.com/.a/6a00d8341d3df553ef010535ce543e970c-800wi Nicholas Carr (and here) has some problems with Tim O'Reilly's theory about the cloud and the network effect. http://feeds.feedburner.com/~f/GeekAndPoke?i=OFn0M... (0 Replies)
Discussion started by: Linux Bot
0 Replies

5. Shell Programming and Scripting

Nullify the effect of Trap command in later part of the script

Hi All, i have an issue regarding trap command. i have specified trap function in the beginning of the script to catch some signals but in the later part of the script i want to remove the effect of this. Can anybody help me out of this. for e.g. pressing Ctrl+C for the first time should... (2 Replies)
Discussion started by: vikas_kesarwani
2 Replies

6. Shell Programming and Scripting

Reading the Properties File From Shell script

Hi, I am new to the shell script please I need help for following question. I have properties file name called "com.test.properties" I have No of key values in this properties. com.person.name = xyz com.person.age = 55 com.person.address = hello I want read this properties but i... (1 Reply)
Discussion started by: venukjs
1 Replies

7. UNIX for Dummies Questions & Answers

What crontab is in effect after reboot

A basic cron question and I hope I explain it enough. If a person creates a file to use with cron and issues the followin command: crontab I understand this will set the cron entries to whatever is in . However, if we now edit the crontab with: crontab -e and save, how does cron... (3 Replies)
Discussion started by: niswonp
3 Replies

8. Shell Programming and Scripting

script to parse the properties file

Hi Friends, I have a requirement to parse a properties file having a key=value pairs. i need to count the number of key value pairs in the properties file and iterate through each key-value pair. I have written the script to read the number of lines from the property file, but cannot... (2 Replies)
Discussion started by: prashdeep
2 Replies

9. Shell Programming and Scripting

Alias has no effect in script

It doesn't have effect in script but it works on the terminal root@server:/opt/kvm/usecases/logs# alias echo='echo -e' root@server:/opt/kvm/usecases/logs# echo "xxxx\n" xxxx root@server:/opt/kvm/usecases/logs# cat xx.sh #!/bin/bash alias echo='echo -n' echo "sssf \n" ... (3 Replies)
Discussion started by: yanglei_fage
3 Replies

10. Shell Programming and Scripting

awk set $1 to itself, effect on $0

jotne posted an interesting thread an hour or two ago, and ended up with the following: awk '{$1=$1} /^+$/' file I had a question about the effect of $1=$1 assignment, and thought it better to start a new thread, because it's really a different topic. $ cat test.sh set -v echo " abcd" | awk... (3 Replies)
Discussion started by: hanson44
3 Replies
RM(1P)							     POSIX Programmer's Manual							    RM(1P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
rm - remove directory entries SYNOPSIS
rm [-fiRr] file... DESCRIPTION
The rm utility shall remove the directory entry specified by each file argument. If either of the files dot or dot-dot are specified as the basename portion of an operand (that is, the final pathname component), rm shall write a diagnostic message to standard error and do nothing more with such operands. For each file the following steps shall be taken: 1. If the file does not exist: a. If the -f option is not specified, rm shall write a diagnostic message to standard error. b. Go on to any remaining files. 2. If file is of type directory, the following steps shall be taken: a. If neither the -R option nor the -r option is specified, rm shall write a diagnostic message to standard error, do nothing more with file, and go on to any remaining files. b. If the -f option is not specified, and either the permissions of file do not permit writing and the standard input is a terminal or the -i option is specified, rm shall write a prompt to standard error and read a line from the standard input. If the response is not affirmative, rm shall do nothing more with the current file and go on to any remaining files. c. For each entry contained in file, other than dot or dot-dot, the four steps listed here (1 to 4) shall be taken with the entry as if it were a file operand. The rm utility shall not traverse directories by following symbolic links into other parts of the hier- archy, but shall remove the links themselves. d. If the -i option is specified, rm shall write a prompt to standard error and read a line from the standard input. If the response is not affirmative, rm shall do nothing more with the current file, and go on to any remaining files. 3. If file is not of type directory, the -f option is not specified, and either the permissions of file do not permit writing and the standard input is a terminal or the -i option is specified, rm shall write a prompt to the standard error and read a line from the standard input. If the response is not affirmative, rm shall do nothing more with the current file and go on to any remaining files. 4. If the current file is a directory, rm shall perform actions equivalent to the rmdir() function defined in the System Interfaces volume of IEEE Std 1003.1-2001 called with a pathname of the current file used as the path argument. If the current file is not a directory, rm shall perform actions equivalent to the unlink() function defined in the System Interfaces volume of IEEE Std 1003.1-2001 called with a pathname of the current file used as the path argument. If this fails for any reason, rm shall write a diagnostic message to standard error, do nothing more with the current file, and go on to any remaining files. The rm utility shall be able to descend to arbitrary depths in a file hierarchy, and shall not fail due to path length limitations (unless an operand specified by the user exceeds system limitations). OPTIONS
The rm utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines. The following options shall be supported: -f Do not prompt for confirmation. Do not write diagnostic messages or modify the exit status in the case of nonexistent operands. Any previous occurrences of the -i option shall be ignored. -i Prompt for confirmation as described previously. Any previous occurrences of the -f option shall be ignored. -R Remove file hierarchies. See the DESCRIPTION. -r Equivalent to -R. OPERANDS
The following operand shall be supported: file A pathname of a directory entry to be removed. STDIN
The standard input shall be used to read an input line in response to each prompt specified in the STDOUT section. Otherwise, the standard input shall not be used. INPUT FILES
None. ENVIRONMENT VARIABLES
The following environment variables shall affect the execution of rm: LANG Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of IEEE Std 1003.1-2001, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_COLLATE Determine the locale for the behavior of ranges, equivalence classes, and multi-character collating elements used in the extended regular expression defined for the yesexpr locale keyword in the LC_MESSAGES category. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments) and the behavior of character classes within regular expressions used in the extended regular expression defined for the yesexpr locale keyword in the LC_MESSAGES category. LC_MESSAGES Determine the locale for the processing of affirmative responses that should be used to affect the format and contents of diagnostic messages written to standard error. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES . ASYNCHRONOUS EVENTS
Default. STDOUT
Not used. STDERR
Prompts shall be written to standard error under the conditions specified in the DESCRIPTION and OPTIONS sections. The prompts shall con- tain the file pathname, but their format is otherwise unspecified. The standard error also shall be used for diagnostic messages. OUTPUT FILES
None. EXTENDED DESCRIPTION
None. EXIT STATUS
The following exit values shall be returned: 0 All of the named directory entries for which rm performed actions equivalent to the rmdir() or unlink() functions were removed. >0 An error occurred. CONSEQUENCES OF ERRORS
Default. The following sections are informative. APPLICATION USAGE
The rm utility is forbidden to remove the names dot and dot-dot in order to avoid the consequences of inadvertently doing something like: rm -r .* Some implementations do not permit the removal of the last link to an executable binary file that is being executed; see the [EBUSY] error in the unlink() function defined in the System Interfaces volume of IEEE Std 1003.1-2001. Thus, the rm utility can fail to remove such files. The -i option causes rm to prompt and read the standard input even if the standard input is not a terminal, but in the absence of -i the mode prompting is not done when the standard input is not a terminal. EXAMPLES
1. The following command: rm a.out core removes the directory entries: a.out and core. 2. The following command: rm -Rf junk removes the directory junk and all its contents, without prompting. RATIONALE
For absolute clarity, paragraphs(2b) and(3) in the DESCRIPTION of rm describing the behavior when prompting for confirmation, should be interpreted in the following manner: if ((NOT f_option) AND ((not_writable AND input_is_terminal) OR i_option)) The exact format of the interactive prompts is unspecified. Only the general nature of the contents of prompts are specified because imple- mentations may desire more descriptive prompts than those used on historical implementations. Therefore, an application not using the -f option, or using the -i option, relies on the system to provide the most suitable dialog directly with the user, based on the behavior specified. The -r option is historical practice on all known systems. The synonym -R option is provided for consistency with the other utilities in this volume of IEEE Std 1003.1-2001 that provide options requesting recursive descent through the file hierarchy. The behavior of the -f option in historical versions of rm is inconsistent. In general, along with "forcing" the unlink without prompting for permission, it always causes diagnostic messages to be suppressed and the exit status to be unmodified for nonexistent operands and files that cannot be unlinked. In some versions, however, the -f option suppresses usage messages and system errors as well. Suppressing such messages is not a service to either shell scripts or users. It is less clear that error messages regarding files that cannot be unlinked (removed) should be suppressed. Although this is historical practice, this volume of IEEE Std 1003.1-2001 does not permit the -f option to suppress such messages. When given the -r and -i options, historical versions of rm prompt the user twice for each directory, once before removing its contents and once before actually attempting to delete the directory entry that names it. This allows the user to "prune" the file hierarchy walk. His- torical versions of rm were inconsistent in that some did not do the former prompt for directories named on the command line and others had obscure prompting behavior when the -i option was specified and the permissions of the file did not permit writing. The POSIX Shell and Utilities rm differs little from historic practice, but does require that prompts be consistent. Historical versions of rm were also incon- sistent in that prompts were done to both standard output and standard error. This volume of IEEE Std 1003.1-2001 requires that prompts be done to standard error, for consistency with cp and mv, and to allow historical extensions to rm that provide an option to list deleted files on standard output. The rm utility is required to descend to arbitrary depths so that any file hierarchy may be deleted. This means, for example, that the rm utility cannot run out of file descriptors during its descent (that is, if the number of file descriptors is limited, rm cannot be imple- mented in the historical fashion where one file descriptor is used per directory level). Also, rm is not permitted to fail because of path length restrictions, unless an operand specified by the user is longer than {PATH_MAX}. The rm utility removes symbolic links themselves, not the files they refer to, as a consequence of the dependence on the unlink() function- ality, per the DESCRIPTION. When removing hierarchies with -r or -R, the prohibition on following symbolic links has to be made explicit. FUTURE DIRECTIONS
None. SEE ALSO
rmdir(), the System Interfaces volume of IEEE Std 1003.1-2001, remove(), rmdir(), unlink() COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 RM(1P)
All times are GMT -4. The time now is 10:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy