Q:

How to detect ubuntu in a shared bashrc?

I share my .bashrc (all my dotfiles, actually) between ubuntu and archlinux. Since the paths may vary between them, I'd like to run some commands only on ubuntu (and others only on archlinux). How can i detect whether I am running ubuntu inside the .bashrc file? Detecting Debian will probably work.

A:

The result of uname -v on my machine contains "Ubuntu" - Maybe you can use that? However, a more portable solution would be to check for the existence of the paths instead:
FOO=/path/to/executable
if [ -x "$FOO" ]
then
    "$FOO" --option
fi

This is the standard way in GNU makefiles.

