Avatar of volleyballjerry
volleyballjerry
Flag for United States of America asked on

Converting .csh to .bash script that removes directory using find and rm

I am converting a one-line script from csh to bash. The script simply removes a directory as specified by an argument on the command line.

cleanup.sh:

#!/bin/sh
find $1/testdir -exec rm -Rf {} +

works perfectly.

The following - cleanup.bash:

#!/bin/bash
find $1/testdir -exec rm -Rf {} +

results in the following error


$ bash cleanup.bash directory1
find: paths must precede expression:
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

Been racking my brains trying all sorts of things for a day now with suggestions from google. Please note - from the command line, this works perfectly. Just does not run inside bash script.
Linux* BashScripting Languages

Avatar of undefined
Last Comment
tel2

8/22/2022 - Mon
SOLUTION
tel2

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
volleyballjerry

ASKER
tel2 - that is correct! Thanks for the clarification.
ASKER CERTIFIED SOLUTION
tel2

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
volleyballjerry

ASKER
Thanks for your help!
tel2

Thanks for your points!
Your help has saved me hundreds of hours of internet surfing.
fblack61