0
#!/bin/bash
18 if [ "$arg" == "jpg" ] then
19      "$(find ./"$folder" -type f -name "*.jpg" -exec mv {} "$arg" \;)"
20 fi

This block of code above works and the find and mv command executes and I have the output in the jpg folder but my script outputs

line 19: command not found.

The find command works fine without any such error outputs on the command line but when written in bash script prints line number: command not found only for the find command written above.

Cyrus
  • 84,225
  • 14
  • 89
  • 153
catBuddy
  • 367
  • 1
  • 3
  • 15
  • 1
    What are the outer quotes for?!? And why are you using the `$()` construction? Its used for getting output of a command as a string, not for running a command. IMHO both are to be removed. – d.c. Feb 16 '21 at 10:53
  • Not a stellar duplicate, but just take out the superfluous command substitution around the command. – tripleee Feb 16 '21 at 12:32

0 Answers0