'unexpected token' error using FIND in script to delete old files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting 'unexpected token' error using FIND in script to delete old files
# 8  
Old 05-03-2010
Too bad I haven't a busybox based OS to test.
This might work:
Code:
find /raid0/data/nas_backup/media_deleted -mtime +30 -type f -print | while read a
do
   rm -f "$a"
done

# 9  
Old 05-03-2010
Quote:
Originally Posted by jlliagre
Too bad I haven't a busybox based OS to test.
This might work:
Code:
find /raid0/data/nas_backup/media_deleted -mtime +30 -type f -print | while read a
do
   rm -f "$a"
done


SUCCESS!!! You're brilliant!!Smilie


Many thanks
Richard

Last edited by rpalmer68; 05-04-2010 at 12:00 AM..
# 10  
Old 05-04-2010
Interesting thread. The find displays the symptoms of spawning a new shell on each exec and has the '{}' syntax for filenames with spaces.
The issue with parentheses in filenames is new to me.
Historically this type of find version was capable of crashing unix through spawning too many concurrent processes.

You are better off with jlliagre's construct whether or not the filenames contain spaces and parentheses.

Did this version of "find" come on the release kit?
# 11  
Old 05-04-2010
Quote:
Originally Posted by methyl
Interesting thread. The find displays the symptoms of spawning a new shell on each exec and has the '{}' syntax for filenames with spaces.
The issue with parentheses in filenames is new to me.
Historically this type of find version was capable of crashing unix through spawning too many concurrent processes.

You are better off with jlliagre's construct whether or not the filenames contain spaces and parentheses.

Did this version of "find" come on the release kit?
Glad I could be interesting Smilie

I'm totally new to Linux, so haven't tampered at all. Whatever is on this box is whatever is the standard release for the 2.1.09 firmware on a Thecus N5200Pro NAS box.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Syntax error near unexpected token `|'

Hi All; I try to write a bash code and I am using command substitution. My code is like: #!/bin/bash IP="10.0.0.1 10.0.0.2" PORT="22 80" USERNAME="admin" SCRIPT_HOST="adminHost" HOME_DIR=/home/admin SCRIPT_DIR=$HOME_DIR/scripts script="sudo /my_remote_script.sh" SSH="/usr/bin/ssh... (7 Replies)
Discussion started by: Meacham12
7 Replies

2. Shell Programming and Scripting

Syntax error near unexpected token `else'

Hi, I am trying to read the session log through script. But it keeps showing me some error near. I have tried everything. Even tried converting the script using sed command to remove the hidden characters(\r).But nothing seems to be working.Below is the script : #!/bin/bash cd... (6 Replies)
Discussion started by: Aryan12345
6 Replies

3. Shell Programming and Scripting

Cannot execute/finish script because of last line syntax error: unexpected end of file/token `done'

first of all I thought the argument DONE is necessary for all scripts that have or begin with do statements which I have on my script, However, I still don't completely understand why I am receiving an error I tried adding another done argument statement but didn't do any good. I appreciate... (3 Replies)
Discussion started by: wolf@=NK
3 Replies

4. Shell Programming and Scripting

Syntax error near unexpected token `('

What do I do here? #!/bin/bash payload=-1 AND 1=IF(21,BENCHMARK(5000000,MD5(CHAR(115,113,108,109,97,112))),0)# hash=`echo -n $payload md5sum tr -d 'n' sed 'ss-sg' md5sum tr -d 'n' sed 'ss-sg'` curl --data cs2=chronopay&cs1=$payload&cs3=$hash&transaction_type=rebill... (2 Replies)
Discussion started by: iiiiiiiiiii
2 Replies

5. Shell Programming and Scripting

syntax error near unexpected token `='

Hi all, This is a script which converts hex to bin. However am finding an error while executing syntax error near unexpected token `=' `($hexfile, $binfile) = @ARGV;' I am running using ./fil.pl <hexfile> <binfile> ################################################### # # this script... (3 Replies)
Discussion started by: jaango123
3 Replies

6. UNIX for Dummies Questions & Answers

Syntax error near unexpected token

hi! just want to seek help on this error: syntax error near unexpected token 'do this is my script # !/bin/sh # for y in 27 25 do exemmlmx -c "ZEEI;" -n XRT$y >> blah done what can be wrong? thanks! (6 Replies)
Discussion started by: engr.jay
6 Replies

7. Shell Programming and Scripting

Unexpected Token Error `;;'

Hello all, Im having an Issue with my script for switch statement , can someone let me know where do i need to correct it. 7 ##******************************************************************************************************* 8 ## ********** FUNCTION USAGE *********** ... (13 Replies)
Discussion started by: raghunsi
13 Replies

8. UNIX for Advanced & Expert Users

syntax error near unexpected token '{

Hi, I am running the following script through cygwin and getting below mentioned error. ******************************************* #!/bin/sh # constants WORK_DIR="deploy" INFOFILE="deploy.info" INTROFILE="Intro.sh" CMGMT_PKG="com.kintana.cmgmt.deploy" DEPLOY_PREFIX="mitg" ... (2 Replies)
Discussion started by: MandyR
2 Replies

9. Shell Programming and Scripting

Syntax error near unexpected token `('

Guys , This is an output of my script errored out for "Syntax error near unexpected token `(' " Can someone tell me whats wrong with my script. Below is my original script pasted. #!/bin/bash Script Creation Date 01/21/2010 Author baraghun ... (7 Replies)
Discussion started by: raghunsi
7 Replies

10. Shell Programming and Scripting

While loop error: Unexpected token done

I have tried to implement a while loop into the code but upon running the following code i am getting the errors: ./Assigntest: line 42: syntax error near unexpected token `done' ./Assigntest: line 42: `done' The code is as follows: #!/bin/bash #Filename: Assignment Author: Luke... (9 Replies)
Discussion started by: warlock129
9 Replies
Login or Register to Ask a Question