Skip to content

Instantly share code, notes, and snippets.

@cuschk
Last active July 15, 2022 05:47
Show Gist options
  • Select an option

  • Save cuschk/627b14f36fa8badefd5c to your computer and use it in GitHub Desktop.

Select an option

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

cuschk commented Jul 8, 2016

Copy link
Copy Markdown
Author

Also see filename.sh.

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