2023-02-07 11:35:22 +00:00
|
|
|
#!/bin/sh
|
2022-11-19 13:37:13 +00:00
|
|
|
|
2022-11-23 16:58:20 +00:00
|
|
|
test "$1" = "--help" || test -z "$1" && {
|
2023-02-07 11:35:22 +00:00
|
|
|
printf "%s\n" "usage: rose-mklink <alias> <url>" \
|
|
|
|
"Create a /usr/bin link to a website."
|
2022-11-23 16:58:20 +00:00
|
|
|
exit
|
|
|
|
}
|
2022-11-19 13:37:13 +00:00
|
|
|
|
2022-11-23 16:58:20 +00:00
|
|
|
test -z "$2" || {
|
2022-12-16 09:07:43 +00:00
|
|
|
test -f "/usr/bin/$1" && {
|
2022-11-19 13:37:13 +00:00
|
|
|
echo "/usr/bin/$1 already exists, remove it first"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2023-02-07 11:35:22 +00:00
|
|
|
printf "#!/bin/sh\n\nrose %s" "$2" > /usr/bin/$1
|
2022-11-19 13:37:13 +00:00
|
|
|
chmod +x /usr/bin/$1
|
|
|
|
}
|