Home Man
Search
Today's Posts
Register

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Calling a find/remove within a script

Tags
shell scripts

Login to Reply

 
Thread Tools Search this Thread
# 8  
Old 05-15-2017
This script work fine in my computer:

Code:
#!/bin/ksh 
#Script Below# 
#Add additional lines to config options. 
. ./prune.config 
eval "$DIR1 $DIR1OPTIONS"

Regards.

---------- Post updated at 05:25 PM ---------- Previous update was at 04:12 PM ----------

This also work fine:

Code:
DIR1="find /directory/holding"
DIR1OPTIONS="-type f ! -name \"*.gz\" ! -name "*PDF*" ! -name \"*TIF*\" -size +1000k -mmin +120 -exec gzip {} ;"
$DIR1 $DIR1OPTIONS

(Without the backslash before the semi colon).

Regards.
# 9  
Old 05-16-2017
Quote:
Originally Posted by AbelLuis
.
.
.
The final \; for the exec clause is mandatory. I don't know why you add the plus sign to the filename : {}+ .

Try
Code:
-exec gzip {} \;

.
.
.
.
Not necessarily. man find (on my linux: find (GNU findutils) 4.7.0-git)
Quote:
-exec command {} +
This variant of the -exec action runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files.
But: a space before the + may be compulsory.
# 10  
Old 05-16-2017
Quote:
Originally Posted by RudiC
Not necessarily. man find (on my linux: find (GNU findutils) 4.7.0-git)


But: a space before the + may be compulsory.
Yes, it's true. The problem was the lack of a space between {} and +.

Regards.
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
find -exec How to add additional parameter when calling a funtion jcdole Shell Programming and Scripting 5 10-10-2017 08:50 AM
Can't remove spaces with sed when calling it from sh -c Tribe Shell Programming and Scripting 3 12-13-2014 03:31 AM
calling a shell script present on another server using perl script. anandgodse Shell Programming and Scripting 3 07-18-2012 01:24 AM
How we can pass the argument when calling shell script from perl script anuragpgtgerman Shell Programming and Scripting 5 03-21-2012 03:57 PM
Shell script calling Perl function, sort and find data, write to new files kowit010 Homework & Coursework Questions 6 11-02-2011 09:39 PM
Running a unix script(which is calling another script inside that) in background rohithji Shell Programming and Scripting 2 11-06-2009 12:52 AM
How to return the value from the called shell script to the calling sh script gp_singh Shell Programming and Scripting 2 05-05-2009 01:17 AM
Script to find and remove characters Zerby Shell Programming and Scripting 5 01-30-2008 01:16 AM
i am trying to find out who is calling me gail Security 2 07-09-2005 06:48 PM
How to Find who is calling me? uxbala Programming 9 02-15-2005 12:58 AM


All times are GMT -4. The time now is 11:20 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password