Shell Script - RAR

Help -- Relatively new to Hazel and relatively new to Mac in general, so sincere apologies if this is extremely basic stuff.
I want to use the command-line version of RAR to automatically move certain filetypes in a specific folder to a specific RAR file.
Let's say by way of example that the extension is .xyz, the folder is "~/Documents/XYZ Files", and the RAR file is "~/Documents/RAR File.rar"
I created a rule that says if extension is .xyz then run embedded script. I've put the rar folder in ~/Library and my script says:
~/Library/RAR/rar m ~/Documents/RAR\ File.rar "$1"
This returns an error code 6. I can open a bash shell and make the command work by hand.
I'm sure I'm missing something stupidly obvious. Any ideas what it might be? Is it the space character in the source folder name "~/Documents/XYZ Files"? That's why I put quote marks around $1.
I want to use the command-line version of RAR to automatically move certain filetypes in a specific folder to a specific RAR file.
Let's say by way of example that the extension is .xyz, the folder is "~/Documents/XYZ Files", and the RAR file is "~/Documents/RAR File.rar"
I created a rule that says if extension is .xyz then run embedded script. I've put the rar folder in ~/Library and my script says:
~/Library/RAR/rar m ~/Documents/RAR\ File.rar "$1"
This returns an error code 6. I can open a bash shell and make the command work by hand.
I'm sure I'm missing something stupidly obvious. Any ideas what it might be? Is it the space character in the source folder name "~/Documents/XYZ Files"? That's why I put quote marks around $1.