Sponsored Content
Top Forums Shell Programming and Scripting Bash script deleting my files, and editing files in subdirectories question Post 302886817 by Chubler_XL on Monday 3rd of February 2014 07:45:50 PM
Old 02-03-2014
Could you avoid bash4 (and globstar) requirement by replacing:

Code:
shopt -s globstar

for file in ./**; do
        [ -f "$file" ] || continue # only "regular" files

with

Code:
find . -type f -print | while read file; do

This User Gave Thanks to Chubler_XL For This Post:
 

10 More Discussions You Might Find Interesting

1. Solaris

editing files with script

hi guys, We have to implement new local (/etc/default/login) USER security policy on almost 50 stations. so editing /etc/default/login and /etc/default/passwd will be way too long work. Can we do the same using some script, I mean editing the above files and putting variables as RETRIES=3, ... (5 Replies)
Discussion started by: Asteroid
5 Replies

2. Shell Programming and Scripting

Script for editing column files

Hi, I have been doing files editing (using "vi") to change the period (e.g. 0902 to 0903) for 100 files each week as shown in the example below. I would like to have a script to solve this manual files editing. Please advice. Example: Change from: ... (2 Replies)
Discussion started by: JunZ
2 Replies

3. Web Development

bash script editing my apache config files

okay i'm going to try to say this uber-simple: I use dropbox (file-sync service). in order for dropbox sync files, they must be its children eg. somewhere under /home/jzacsh/Dropbox]. I want to now use it to keep my development files in sync across my machines: easy: just move my dev. files... (2 Replies)
Discussion started by: jzacsh
2 Replies

4. Shell Programming and Scripting

Bash: Gzip files in Directory and itīs Subdirectories

Hello dear Community, I have a task to wrtie a script which will gzip not zipped files in a directory and itīs subdirectories. I succeeded in gzippung the directory but not the subdirectories: #/bin/bash #go to the directory where to zip cd $1 #Zip unzipped files for i in `ls | xargs... (2 Replies)
Discussion started by: JamesCarter
2 Replies

5. Shell Programming and Scripting

Editing lists of integers in 1d files with bash shell

Hi, I need a script that will: 1. Go through about 20 different folders, each containing about 20 1d files. The 1d files go something like this: 22.253 37.707 78.117 112.374 127.944 156.067 180.956 233.785 249.256 ... (1 Reply)
Discussion started by: ac130pilot
1 Replies

6. Shell Programming and Scripting

Script to Archive Files from Subdirectories

Hello, I have a CentOS server that contains a 'storage' directory. Within that directory, there could be any number of subfolders (all with unique names that match usernames). Under each username folder, there are two additional folders: db and files /STORAGE/user1/db/... (3 Replies)
Discussion started by: JasonH
3 Replies

7. UNIX for Dummies Questions & Answers

Crontab deleting files command question

Hello out there, Our system has a pdf generator that creates pdf files. We dont need them pas 120 days. So I have this command in my crontab. I currently set it to "0" for testing. But normally have it set to -mtime 120 to remove files out of the folders from PDF out to several other potential... (7 Replies)
Discussion started by: vsekvsek
7 Replies

8. Shell Programming and Scripting

Unzip all the files with subdirectories present and append a part of string from the main .zip files

Hi frnds, My requirement is I have a zip file with name say eg: test_ABC_UH_ccde2a_awdeaea_20150422.zip within that there are subdirectories on each directory we again have .zip files and in that we have files like mama20150422.gz and so on. Iam in need of a bash script so that it unzips... (0 Replies)
Discussion started by: Ravi Kishore
0 Replies

9. Shell Programming and Scripting

Append string to all the files inside a directory excluding subdirectories and .zip files

Hii, Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories. Eg. file1: test1.log file2: test2.log file3 test.zip After running the script file1: string_test1.log file2: string_test2.log file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies

10. UNIX for Beginners Questions & Answers

Help with running a script on files located in subdirectories

Hello everyone, I'm am a newbie to coding so I am reaching out in hopes that I can get some help from this forum. I am trying to run the script below from a single directory, however the directory has many subfolders. In each of those subfolders is a file, uniquely named to that specific... (3 Replies)
Discussion started by: azurite
3 Replies
SPCTL(8)						    BSD System Manager's Manual 						  SPCTL(8)

NAME
spctl -- SecAssessment system policy security SYNOPSIS
spctl --assess [-t type] [-] file ... spctl --master-enable | --master-disable spctl --enable | --disable | --remove [-t type] [--path path] [--requirement requirement] [--anchor hash] [--hash hash] spctl --status DESCRIPTION
spctl manages the security assessment policy subsystem. This subsystem maintains and evaluates rules that determine whether the system allows the installation, execution, and other operations on files on the system. spctl requires one command option that determines its principal operation: --add Add rule(s) to the system-wide assessment rule database. -a, --assess Requests that spctl perform an assessment on the files given. --disable Disable one or more rules in the assessment rule database. Disabled rules are not considered when performing assessment, but remain in the database and can be re-enabled later. --enable Enable rule(s) in the assessment rule database, counteracting earlier disabling. --disable --master-disable Disable the assessment subsystem altogether. Operations that would be denied by system policy will be allowed to proceed; assess- ment APIs always report success. Requires root access. --master-enable Enable the assessment subsystem. Operations that are denied by system policy will fail; assessment APIs report the truth. Requires root access. --remove Remove rule(s) from the assessment rule database. --status Query whether the assessment subsystem is enabled or disabled. In addition, the following options are recognized: --anchor In rule update operations, indicates that the arguments are hashes of anchor certificates. --continue If the assessment of a file fails, continue assessing additional file arguments. Without this option, the first failed assessment terminates operation. --hash In rule update operations, indicates that the arguments are code directory hashes. --ignore-cache Do not query or use the assessment object cache. This may significantly slow down operation. Newly generated assessments may still be stored in the cache. --label label Specifies a string label to attach to new rules, or find in existing rules. Labels are arbitrary strings that are assigned by con- vention. Rule labels are optional. --no-cache Do not place the outcome of any assessments into the assessment object cache. No other assessment may reuse this outcome. This option not prohibit the use of existing cache entries. --path In rule update operations, indicates that the argument(s) denote paths to files on disk. --priority priority In rule update operations, specifies the priority of the rule(s) created or changed. Priorities are floating-point numbers. Higher numeric values indicate higher priority. --raw When displaying the outcome of an assessment, write it as a "raw" XML plist instead of parsing it in somewhat more friendly form. This is useful when used in scripts, or to access newly invented assessment aspects that spctl does not yet know about. --requirement In rule update operations, indicates that the argument(s) are code requirement source. --rule In rule update operations, indicates that the argument(s) are the index numbers of existing rules. -t, --type Specify which type of assessment is desired: execute to assess code execution, install to assess installation of an installer pack- age, and open to assess the opening of documents. The default is to assess execution. -v, --verbose Requests more verbose output. Repeat the option or give it a higher numeric value to increase verbosity. RULE SUBJECTS
The system assessement rule database contains entries that match candidates based on Code Requirements. spctl allows you to specify these requirements directly using the --requirement option. In addition, individual programs on disk can be addressed with the --path option (which uses their Designated Requirement). The --anchor option takes the hash of a (full) certificate and turns it into a requirement match- ing any signature based on that anchor certificate. Alternatively, it can take the absolute path of a certificate file on disk, containing the DER form of an anchor certificate. Finally, the --hash option generates a code requirement that denotes only and exactly one program whose CodeDirectory hash is given. The means of specifying subjects does not affect the remaining processing. FILES
/var/db/SystemPolicy The system policy database. /var/db/.SystemPolicy-default A copy of the initial distribution version of the system policy database. Useful for starting over if the database gets messed up beyond recognition. EXAMPLES
To check whether Mail.app is allowed to run on the local system: spctl -a /Applications/Mail.app To allow Frobozz.app to run on the local system: spctl --add --label "My Stuff" /Applications/Frobozz.app To forbid all code obtained from the Mac App Store from running: spctl --disable --label "Mac App Store" DIAGNOSTICS
spctl exits zero on success, or one if an operation has failed. Exit code two indicates unrecognized or unsuitable arguments. If an assess- ment operation results in denial but no other problem has occurred, the exit code is three. SEE ALSO
codesign(1), syspolicyd(1) HISTORY
The system policy facility and spctl command first appeared in Mac OS X Lion 10.7.3 as a limited developer preview. BSD
January 19, 2012 BSD
All times are GMT -4. The time now is 09:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy