Terminal Paste File Name Only

Hello,
I'm using Hazel to identify an .RTF file with a specific name and then I want to paste just that file's name without the extension (but not actual path) into the terminal.
Here's where I've gotten so far with the shell script, except I get an error in the logs:
What I want it to output is:
I've also tried this and get an error as well:
Does anyone have any suggestions? I'm wondering if the "$1" needs to appear somewhere in the terminal's action?
If I could see the actual terminal output, that might help diagnose the problem, too. Is that possible to get it to run in a visible terminal?
Thanks!
I'm using Hazel to identify an .RTF file with a specific name and then I want to paste just that file's name without the extension (but not actual path) into the terminal.
Here's where I've gotten so far with the shell script, except I get an error in the logs:
- Code: Select all
filename=$(basename "$1")
filename=${filename%.*}
server="https://www.server.com/"
hash="$server$filename"
/usr/bin/app "$hash"
What I want it to output is:
- Code: Select all
/usr/bin/app https://server.com/filename
I've also tried this and get an error as well:
- Code: Select all
LONG_FILENAME="$1"
VARIABLE=$(basename "$LONG_FILENAME")
server="https://www.server.com/"
hash="$server$filename"
hash="$server$VARIABLE"
Does anyone have any suggestions? I'm wondering if the "$1" needs to appear somewhere in the terminal's action?
If I could see the actual terminal output, that might help diagnose the problem, too. Is that possible to get it to run in a visible terminal?
Thanks!