aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-01-16 08:03:21 +0100
committerMattias Andrée <maandree@kth.se>2017-01-16 08:03:21 +0100
commitcd63924da6e212b5672724b422eadbc71bf4e614 (patch)
tree3120836f3df439cc79c3fc10c55593aa55b22b3f
parentAdd blind-rotate-90, blind-rotate-180, and blind-rotate-270 (diff)
downloadblind-cd63924da6e212b5672724b422eadbc71bf4e614.tar.gz
blind-cd63924da6e212b5672724b422eadbc71bf4e614.tar.bz2
blind-cd63924da6e212b5672724b422eadbc71bf4e614.tar.xz
blind-rotate-*: support arbitrary paths
Only an idiot would use <newline> in paths, but let's support it anyway (for fun).
-rwxr-xr-xblind-rotate-1804
-rwxr-xr-xblind-rotate-2704
-rwxr-xr-xblind-rotate-904
3 files changed, 6 insertions, 6 deletions
diff --git a/blind-rotate-180 b/blind-rotate-180
index 73cbd15..2f50956 100755
--- a/blind-rotate-180
+++ b/blind-rotate-180
@@ -12,7 +12,7 @@ if ! test $# = 0; then
fi
fi
-flip="$(printf '%s\n' "$0" | sed 's/[^/]*$/blind-flip/')"
-flop="$(printf '%s\n' "$0" | sed 's/[^/]*$/blind-flop/')"
+flip="$(printf '%s\n' "$0" | tr '/\n' '\n/' | sed '$s/^.*$/blind-flip\//' | tr '/\n' '\n/')"
+flop="$(printf '%s\n' "$0" | tr '/\n' '\n/' | sed '$s/^.*$/blind-flop\//' | tr '/\n' '\n/')"
"$flip" | "$flop"
diff --git a/blind-rotate-270 b/blind-rotate-270
index 77305ca..4c97b96 100755
--- a/blind-rotate-270
+++ b/blind-rotate-270
@@ -12,7 +12,7 @@ if ! test $# = 0; then
fi
fi
-transpose="$(printf '%s\n' "$0" | sed 's/[^/]*$/blind-transpose/')"
-flop="$( printf '%s\n' "$0" | sed 's/[^/]*$/blind-flop/')"
+transpose="$(printf '%s\n' "$0" | tr '/\n' '\n/' | sed '$s/^.*$/blind-transpose\//' | tr '/\n' '\n/')"
+flop="$( printf '%s\n' "$0" | tr '/\n' '\n/' | sed '$s/^.*$/blind-flop\//' | tr '/\n' '\n/')"
"$flop" | "$transpose"
diff --git a/blind-rotate-90 b/blind-rotate-90
index bbecc5b..9e41ef5 100755
--- a/blind-rotate-90
+++ b/blind-rotate-90
@@ -12,7 +12,7 @@ if ! test $# = 0; then
fi
fi
-transpose="$(printf '%s\n' "$0" | sed 's/[^/]*$/blind-transpose/')"
-flop="$( printf '%s\n' "$0" | sed 's/[^/]*$/blind-flop/')"
+transpose="$(printf '%s\n' "$0" | tr '/\n' '\n/' | sed '$s/^.*$/blind-transpose\//' | tr '/\n' '\n/')"
+flop="$( printf '%s\n' "$0" | tr '/\n' '\n/' | sed '$s/^.*$/blind-flop\//' | tr '/\n' '\n/')"
"$transpose" | "$flop"