The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to find a file named vijay in a directory using find command amirthraj_12 UNIX for Dummies Questions & Answers 6 10-25-2008 01:37 PM
Help Required: Command to find IP address and command executed of a user loggedout Security 2 08-06-2008 09:12 PM
Little bit weired : Find files in UNIX w/o using find or where command jatin.jain Shell Programming and Scripting 10 09-19-2007 07:47 AM
command find returned bash: /usr/bin/find: Argument list too long yacsil Shell Programming and Scripting 1 12-15-2003 06:38 PM
how to find a file in UNIX without find command? bluo Shell Programming and Scripting 3 09-25-2003 12:47 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-24-2007
vikramsnest vikramsnest is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 7
Err while using find command

hi frnds,
I have written a script as follows.

ssh username@servername "find $1 -type f -name $2 -mtime +1 -exec rm '{}' \;"


when i excute tis script i get error
FIND: Parameter format not correct

parameter 2 is the file name .. .

Thx in advance
  #2 (permalink)  
Old 08-24-2007
reborg's Avatar
reborg reborg is online now Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,242
guess #1 You are using a glob patter for name and it is being incorrectly expanded due to the way you are quoting the expression.

try:

Code:
"find $1 -type f -name \"$2\" -mtime +1 -exec rm '{}' \;"

  #3 (permalink)  
Old 08-24-2007
vikramsnest vikramsnest is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 7
Still the err is der

Thanx a lot ..
but i am still facing the error ..any more guess

thx
  #4 (permalink)  
Old 08-24-2007
vikramsnest vikramsnest is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 7
Quote:
Originally Posted by reborg View Post
guess #1 You are using a glob patter for name and it is being incorrectly expanded due to the way you are quoting the expression.

try:

Code:
"find $1 -type f -name \"$2\" -mtime +1 -exec rm '{}' \;"
--------------------------------------------------------------------------------
"/bin/find $1 -type f -name \"$2\" -mtime +1 -exec rm '{}' \;"
Thanx reborg
but i solved it ....
i am using ssh to contect to remote server ... and then find files and delete them...

Last edited by vikramsnest; 08-26-2007 at 02:24 PM..
  #5 (permalink)  
Old 08-27-2007
ahmedwaseem2000 ahmedwaseem2000 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Bangalore
Posts: 219
Reborgs command is working for me. also this one is working for me in ksh:


Code:
find $1 -type f -name "$2" -mtime +1 -exec rm '{}' \;

  #6 (permalink)  
Old 08-27-2007
reborg's Avatar
reborg reborg is online now Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,242
Quote:
Originally Posted by ahmedwaseem2000 View Post
Reborgs command is working for me. also this one is working for me in ksh:


Code:
find $1 -type f -name "$2" -mtime +1 -exec rm '{}' \;
My command is only becasue of the use of SSH to run this without the ssh the additional escaping should not be needed.
  #7 (permalink)  
Old 08-28-2007
ahmedwaseem2000 ahmedwaseem2000 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Bangalore
Posts: 219
what difference does a secure shell make for additional escaping?
Closed Thread

Bookmarks

Tags
mtime

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:59 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0