Link to home
Start Free TrialLog in
Avatar of volleyballjerry
volleyballjerryFlag 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.
SOLUTION
Avatar of tel2
tel2
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of volleyballjerry

ASKER

tel2 - that is correct! Thanks for the clarification.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for your help!
Thanks for your points!