Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting


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

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-30-2012
Registered User
 
Join Date: Jul 2012
Posts: 22
Thanks: 1
Thanked 0 Times in 0 Posts
MySQL Error while executing switch case for find and replace specific file. Help Me...


Code:
case "$inputs" in
sapte)
find /pools/home_unix/sapte/work/models/model -name "*.xml" exec rm -i {} \;;
ckm1)
find /pools/home_unix/ckm1/work/models/model -name "*.xml" exec rm -i {} 
\;;

I am getting error like as below.

Code:
./menu1.sh: line 144: syntax error near unexpected token `)'
./menu1

.sh: line 144: `ckm1)'

Thanks.. prashant

Last edited by Scott; 07-30-2012 at 06:03 AM.. Reason: Please use code tags
Sponsored Links
    #2  
Old 07-30-2012
Scott's Avatar
Scott Scott is online now Forum Staff  
Administrator
 
Join Date: Jun 2009
Location: Zürich
Posts: 7,164
Thanks: 229
Thanked 808 Times in 698 Posts
You need an extra ; because find needs one, and the case needs two.


Code:
  blah) find ..... {} \; ;;

I prefer to put the ;; on a new-line:

Code:
case "$inputs" in
    sapte) find /pools/home_unix/sapte/work/models/model -name "*.xml" exec rm -i {} \;
    ;;
    ckm1) find /pools/home_unix/ckm1/work/models/model -name "*.xml" exec rm -i {}  \;
    ;;
esac


Last edited by Scott; 07-30-2012 at 06:07 AM.. Reason: Typo
Sponsored Links
    #3  
Old 07-30-2012
Registered User
 
Join Date: Jul 2012
Posts: 22
Thanks: 1
Thanked 0 Times in 0 Posts
MySQL

Scott thanks for reply

now i am geting another error which is as below.


Code:
enter option for checking specific user xml files to delete
sapte,ckm1,mdubey,hchede,amukherjee,skedar,averma,dbhatt,vmuthu,stiwari

sapte
find: bad option exec
find: [-H | -L] path-list predicate-list
Hit <ENTER> to continue:



thanks prashant

Last edited by Scott; 07-30-2012 at 06:14 AM.. Reason: Please use code tags
    #4  
Old 07-30-2012
Scott's Avatar
Scott Scott is online now Forum Staff  
Administrator
 
Join Date: Jun 2009
Location: Zürich
Posts: 7,164
Thanks: 229
Thanked 808 Times in 698 Posts
Missing - for the exec option.


Code:
... -exec ...

Sponsored Links
    #5  
Old 07-30-2012
Registered User
 
Join Date: Jul 2012
Posts: 22
Thanks: 1
Thanked 0 Times in 0 Posts
ya scott it is working fine thanks for the same...prashant..
Sponsored Links
Closed 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 from file and replace with specific text libras Shell Programming and Scripting 5 05-09-2012 06:26 AM
Need an awk for a global find/replace in a file, specific column jclanc8 Shell Programming and Scripting 3 03-22-2010 11:20 AM
Find and replace a string a specific value in specific location in AIX techmoris Shell Programming and Scripting 5 03-11-2010 06:24 PM
Error: Find the pattern in the file and replace shreekrishnagd Shell Programming and Scripting 9 03-04-2009 04:04 AM
Ignore case sensitive in Case Switch annelisa Shell Programming and Scripting 1 07-13-2006 04:36 AM



All times are GMT -4. The time now is 07:37 PM.