I am new to Unix shell and to this forum.
I am having some trouble executing an interactive shell script that I have written using Mac TextEdit that takes a user input via terminal of a file type (jpg or gif) and then activates a script that will iterate through a folder of unsorted file types located on my desktop, with the aim being, to move these files to a new folder based on the users command.
i.e The user types jpg in the terminal and the script runs and moves all files of type jpg from unsorted into sorted
As it currently stands, When I run the code I am not getting an error, it's merely not moving these files from one directory to the other.
I have tried stack overflow and other sites without success. I do not know if the issue pertains to the fact that the user input is not being caught through the read command or perhaps there is a wider issue with my code.
Any help making this code run would be greatly appreciated.
#!/bin/bash
echo �Good Morning, Please enter your file type name for sorting [ENTER]:�
read file
if [[ �$file� == jpg ]]; then
mv /Users/christopherdorman/desktop/unsorted/*.jpg /Users/christopherdorman/desktop/sorted
echo �Good News, Your files have been successfully processed�
fi