Reputation: 115
#!/bin/bash
echo "please enter a path where to search:"
read myPath
touch --date "2012-01-01" /tmp/start
touch --date "2012-01-01" /tmp/end
until [ "$myPath" = $(pwd) ]
do
echo "please enter a correct path where to search:"
read myPath
done
RESULT= "$(find $HOME "-type -f" -newer /tmp/start -not -newer tmp/end)"
echo $RESULT
When I'm trying to execute it I'm getting:
find: Arguments to -type should contain only one letter
TimeStamp: line 17: : command not found
Upvotes: 2
Views: 1621
Reputation: 107040
You have:
RESULT= "$(find $HOME "-type -f" -newer /tmp/start -not -newer tmp/end)"
Several things: Remove the quotes around -type -f
. I'm not sure why you put them there. The correct argument for the -type
parameter should be f
and not -f
.
You did a touch on /tmp/end
, but you're looking at tmp/end
. This is saying the same thing as $PWD/tmp/end
. You need a slash at the front to anchor this to the root of the directory structure. You need /tmp/end
and not tmp/end
.
Try:
RESULT= "$(find "$HOME" -type f -newer /tmp/start -not -newer /tmp/end)"
Upvotes: 1
Reputation: 2537
I would try this:
"$(find $HOME -type f -newer /tmp/start -not -newer tmp/end)"
Upvotes: 1
Reputation: 425073
For starters, why do you have -type -f
outside the quotes? And it's
-type f
not -type -f
(no dash before the f
)
Try this:
"$(find $HOME -type f -newer /tmp/start -not -newer tmp/end)"
Upvotes: 2