feat(unitproc/bkt-get_median):Add Bash function to calculate median
[BK-2020-03.git] / doc / user / rmsym.org
1 * rmsym - Symlink deleter
2 #+TITLE: rmsym - Symlink deleter
3 #+AUTHOR: Steven Baltakatei Sandoval
4 #+DATE:2023-02-20
5 #+EMAIL:baltakatei@gmail.com
6 #+LANGUAGE: en
7 #+OPTIONS: toc:nil
8
9 Created by [[https://baltakatei.com][Steven Baltakatei Sandoval]] on
10 2023-02-20T18:43+00
11 under a [[https://creativecommons.org/licenses/by-sa/4.0/][CC BY-SA 4.0]] (🅭🅯🄎4.0) license and last updated on
12 2023-02-20T18:43+00
13
14 ** Summary
15 ~rmsym~ is a Bash script which deletes symbolic links specified by
16 positional arguments.
17
18 ** Versions
19 | Version | Description |
20 |---------+----------------------------------------------------------------|
21 | 0.0.1 | Initial version. Does not accept or pass on arguments to ~rm~. |
22 | | |
23
24 ** Background
25 I needed a script that would let me quickly delete only symlinks if I
26 were to provide it with a mix of paths of files, directories, or
27 symlinks; specifically, I want to be able to create music playlists
28 that any music player can parse; most music players can recursively
29 scan directories and a directory tree of symlinks would reduce the
30 need to maintain multiple copies of music files on the same file
31 system. However, in order to assure myself that when I prune symlinks
32 that I don't delete actual files targeted by the symlinks, I need a
33 program that will only delete symlinks.
34
35 Bash supports testing whether a path is a symlink or not via the ~-h~
36 test. For example, here is a simple Bash script that will report
37 whether a symlink is present at ~$HOME/foo.txt~ or not.
38
39 #+begin_example
40 #!/bin/bash
41 path_myfile="$HOME/foo.txt";
42 if [[ -h "$path_myfile" ]]; then
43 echo "STATUS:Is a symlink:$path_myfile";
44 else
45 echo "STATUS:Is not a symlink:$path_myfile";
46 fi;
47 #+end_example
48
49 ** Reference
50 - "Bash Reference Manual", Section: "[[https://www.gnu.org/software/bash/manual/bash.html#Bash-Conditional-Expressions][6.4 Bash Conditional Expressions]]". gnu.org.