Compare commits

...

2 Commits

  1. 12
      dtcopy.sh

@ -52,15 +52,21 @@ process_a_path () {
# take in the string, read it into array # take in the string, read it into array
IFS=/ read -a arr <<< "${1}" IFS=/ read -a arr <<< "${1}"
i=0 i=0
seglen=0
while [ $i -lt "${#arr[@]}" ]; do while [ $i -lt "${#arr[@]}" ]; do
arr[$i]=$(printf '%s\n' "${arr[$i]}" | iconv -t ASCII//TRANSLIT - | inline-detox) seglen="${#arr[$i]}"
arr[$i]=$(printf '%s\n' "${arr[$i]}" | iconv -t ASCII//TRANSLIT - | inline-detox)
if [ ${#arr[$i]} -eq 0 ];then
arr[$i]=$(printf '%*s' "$seglen" | tr ' ' "_")
fi
let i=i+1 let i=i+1
done done
# stitch it back together # stitch it back together
processed_path=$(printf '/%s' "${arr[@]}") processed_path=$(printf '/%s' "${arr[@]}")
# remove EXTRA leading slash from printf above # remove EXTRA leading slash from printf above
processed_path="${processed_path:1}" processed_path="${processed_path:1}"
#emit our processed path # remove condition where there's an empty portion of PATH
processed_path=$(printf "%s" "${processed_path}" | sed 's@\/\/@\/_\/@g')
echo "${processed_path}" echo "${processed_path}"
} }
@ -91,7 +97,9 @@ process_a_path () {
# with a BASE of /home/steven/music # with a BASE of /home/steven/music
# would result in the path /album/artist/file being copied # would result in the path /album/artist/file being copied
# as the path of the copied file # as the path of the copied file
shift
BASE="${1}" BASE="${1}"
echo "BASE IS ${BASE}"
shift shift
;; ;;
-h|--help) display_help -h|--help) display_help

Loading…
Cancel
Save