Skip to content

Instantly share code, notes, and snippets.

@phatblat
Created April 22, 2013 02:21
Show Gist options
  • Save phatblat/5432046 to your computer and use it in GitHub Desktop.
Save phatblat/5432046 to your computer and use it in GitHub Desktop.
Bash script to extract the repo name out of a URL
#!/bin/bash
[email protected]:phatblat/dotfiles.git
repo=${repo_url##*/}
echo ${repo%%.*}
@pa-0
Copy link

pa-0 commented Jul 27, 2024

Just be mindful that any URL that ends with a forward slash will return . and nothing else.

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