How to pass path of selected file from Finder to Automator Shell script

Solution 1:

Add cd "$(dirname "$f")" before the unzip line.

for f in "$@"; do
    cd "$(dirname "$f")"
    unzip -o "$f"
done 

or without changing to the directory, use the -d option

[-d exdir]
          An  optional  directory  to which to extract files.  By default, all files and subdirectories
          are recreated in the current directory; the -d  option  allows  extraction  in  an  arbitrary
          directory.....



for f in "$@"; do
    unzip "$f" -d "$(dirname "$f")"
done