alias git-repo="xdg-open '$(git config --get remote.origin.url | sed -e 's/:/\//g' -e 's/ssh\/\/\///g' -e 's/git@/https:\/\//g')'"
This alias works, but when I try to run it by hand it doesn't:
xdg-open '$(git config --get remote.origin.url | sed -e 's/:/\//g' -e 's/ssh\/\/\///g' -e 's/git@/https:\/\//g')'
What am I doing wrong?
You shouldn't use variables in single quotes. Try this instead:
xdg-open $(git config --get remote.origin.url | sed -e "s/:/\//g" -e "s/ssh\/\/\///g" -e "s/git@/https:\/\//g")
'$(...)'
part changed to $(...)
, you can also use double quotes but in this case it requires you to escape later double quotes