aboutsummaryrefslogtreecommitdiff
path: root/rosenrot-mklink
blob: d8f5be62d0e48725e3372b52804d967c0cc6d086 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

test "$1" = "--help" || test -z "$1" && {
    printf "%s\n" "usage: rosenrot-mklink <alias> <url>" \
        "Create a /usr/bin link to a website."
	exit
}

test -z "$2" || {
	test -f "/usr/bin/$1" && {
		echo "/usr/bin/$1 already exists, remove it first"
		exit 1
	}

	printf "#!/bin/sh\n\nrosenrot %s" "$2" > /usr/bin/$1
	chmod +x /usr/bin/$1
}