Get the filename from a path using :t modifier. This removes all leading pathname components, leaving just the tail. It works like basename.
#!/bin/zsh
fullpath="/etc/nginx/nginx.conf"
filename=$fullpath:t
echo $filenamenginx.confOr, get the path without the filename using :h modifier
#!/bin/zsh
fullpath="/etc/nginx/nginx.conf"
filename=$fullpath:h
echo $filename/etc/nginxGet the filename without the extension by combining two path modifiers :t and :r
#!/bin/zsh
fullpath="/etc/nginx/nginx.conf"
filename=$fullpath:t:r
echo $filenamenginxGet just the extension by combining :t and :e path modifiers
#!/bin/zsh
fullpath="/etc/nginx/nginx.conf"
ext=$fullpath:t:e
echo $extconf