update(unitproc/bkdstcountdown):Refactor
[BK-2020-03.git] / user / rmsym
... / ...
CommitLineData
1#!/usr/bin/env bash
2# Desc: Delete symlinks; skips non-symlinks
3# Usage: rmsym [paths]
4# Version: 0.0.1
5
6yell() { echo "$0: $*" >&2; } # print script path and all args to stderr
7die() { yell "$*"; exit 111; } # same as yell() but non-zero exit status
8must() { "$@" || die "cannot $*"; } # runs args as command, reports args if command fails
9main () {
10 # Check args
11 for psarg in "$@"; do
12 if [[ -h "$psarg" ]]; then
13 rm "$psarg";
14 else
15 yell "Not a symbolic link; not deleting:$psarg";
16 continue;
17 fi;
18 done;
19}; # main program
20
21main "$@";
22
23# Author: Steven Baltakatei Sandoval
24# License: GPLv3+