Skip to content

Instantly share code, notes, and snippets.

@cuschk
Last active July 15, 2022 05:47
Show Gist options
  • Save cuschk/627b14f36fa8badefd5c to your computer and use it in GitHub Desktop.
Save cuschk/627b14f36fa8badefd5c to your computer and use it in GitHub Desktop.
Zsh: file base name and extension
#!/usr/bin/env zsh
f='example.txt'
echo ${f:r}
#=> example
echo ${f:e}
#=> txt
@cuschk
Copy link
Author

cuschk commented Jul 8, 2016

Also see filename.sh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment