about summary refs log tree commit diff
path: root/profile/.profile.d/open.sh
blob: 8d0cd22f45455aaceaef5e0f5a6b46126104181d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

if [ "$(uname)" = "Linux" ]; then
	if grep -q Microsoft /proc/version; then
		alias open="explorer.exe"
	elif command -v "xdg-open" >/dev/null 2>&1; then
		alias open="xdg-open"
	fi
fi

if command -v "open" >/dev/null 2>&1; then
	o() {
		if [ "${#}" -eq 0 ]; then
			open "${PWD}"
		else
			open "${@}"
		fi
	}
fi

Consider giving Nix/NixOS a try! <3