How to pass inputs to a shell script in automator? I want to pass the filename of the file I rightclicked to a shell script through automator:

# encrypt file.txt to file.enc using 256-bit AES in CBC mode
openssl enc -aes-256-cbc -salt -in file.txt -out file.txt.enc


When I create a 'service' I can pass on the input 'as arguments', but how to I implement it in the code?
It would be great if the file could be called 'file.enc' instead of 'file.txt.enc' if that is possible.
pass=$(osascript -e 'tell app (path to frontmost application as text)
text returned of (display dialog "Enter password:" default answer "")
end')
for f in "$@"; do
    printf %s "$pass" | openssl enc -aes-256-cbc -salt -in "$f" -out "${f%.*}.enc" -pass stdin
done