Sponsored Content
Full Discussion: rm substitute with blacklist
Top Forums UNIX for Dummies Questions & Answers rm substitute with blacklist Post 302149308 by broli on Wednesday 5th of December 2007 03:08:09 PM
Old 12-05-2007
rm substitute with blacklist

hi!
first i want to apologize for two things. my English and (possible) posting in the wrong sub forum (i couldn't find one that fits my question)

I am needing a script that can substitute rm.
the idea is that the operator can/must delete some folders and files from time to time, when the free space on some hard drive is running low, but some other files shouldn't be touched, and you know murphy
i can write a script to do that, but i was hoping someone already did
what i can think is a while loop that reads the blacklist file line by line, and if the %1 equals some line, then echo some msg and stop
but is more complex, i need logs, i have to match full path and, basename of the full path against, the first param. i need to be able to detect errors on the input, and avoid "rm -rf /" hells derived from coding errors

to be clear, i don't want you to make this script (if it has to be done, i will do it, and you will read me in the scripting section asking some specific problems), again, i was hoping some one already invented this wheel

About the interpreter/unix flavour it doesnt matter, if you know one that works on bash/ksh/zsh/csh/.* in SunOS/Linux/AIX/SCO/BSD/.* i will be more than grateful Smilie
 

2 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Multipath devnode blacklist

hi all, there´s one thing i dont understand ... in the file /etc/multipath.conf, why do we incluide "dm-" ??? a device mapper dm- is not supposed to be a multipath part that will be used after configuring mutipath dm?? devnode_blacklist { devnode... (0 Replies)
Discussion started by: pabloli150
0 Replies

2. UNIX for Beginners Questions & Answers

Email alert when client in blacklist joins network

I have a textfile with a list of strings I want to monitor in my network. alertlist: hans franz tanzSo it can output for me whenever the a strings it matched: #!/bin/sh while : ; do testfile="/var/media/ftp/alertlist.txt" ] && echo "${testfile##*/} exists." || echo "${testfile##*/}... (9 Replies)
Discussion started by: lowmaster
9 Replies
SCRIPT(1)						    BSD General Commands Manual 						 SCRIPT(1)

NAME
script -- make typescript of terminal session SYNOPSIS
script [-a] [-k] [-q] [-t time] [file [command ...]] DESCRIPTION
The script utility makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1). If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in the file typescript. If the argument command ... is given, script will run the specified command with an optional argument vector instead of an interactive shell. Options: -a Append the output to file or typescript, retaining the prior contents. -k Log keys sent to program as well as output. -q Run in quiet mode, omit the start and stop status messages. -t time Specify time interval between flushing script output file. A value of 0 causes script to flush for every character I/O event. The default interval is 30 seconds. The script ends when the forked shell (or command) exits (a control-D to exit the Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is not set) for the C-shell, csh(1)). Certain interactive commands, such as vi(1), create garbage in the typescript file. The script utility works best with commands that do not manipulate the screen. The results are meant to emulate a hardcopy terminal, not an addressable one. ENVIRONMENT
The following environment variable is utilized by script: SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most shells set this variable automatically). SEE ALSO
csh(1) (for the history mechanism). HISTORY
The script command appeared in 3.0BSD. BUGS
The script utility places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects. It is not possible to specify a command without also naming the script file because of argument parsing compatibility issues. When running in -k mode, echo cancelling is far from ideal. The slave terminal mode is checked for ECHO mode to check when to avoid manual echo logging. This does not work when in a raw mode where the program being run is doing manual echo. BSD
June 6, 1993 BSD
All times are GMT -4. The time now is 02:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy