0

I want to write a script that allows the user to enter a specific file path and size to use as an input to the find command.

I tried the following:

echo "Enter file path and size":
read userpath
read sz
find $userpath -size $sz -exec rm {} \;

but it results in the error

( find: invalid argument '-exec' to -size)
6
  • does this help? ryanstutorials.net/bash-scripting-tutorial/bash-input.php read userpath sz Commented May 18, 2020 at 18:57
  • no, what I want is the user to enter a size condition Commented May 18, 2020 at 19:11
  • In what way is it not working the way you expect? Commented May 18, 2020 at 19:28
  • What issue do you have with your code? It is not clear in what specific way it is not working. Commented May 18, 2020 at 19:33
  • 1
    First get the find command working when you type it on the command line directly (not in a script). Also, is filepath meant to be a directory or a file? Typically the first argument to the find command is a directory, like . Commented May 18, 2020 at 22:09

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.