From 821cacf62684cc541a4b7674017ef911d9152ca6 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Fri, 15 Jan 2021 17:23:30 +0000 Subject: [PATCH] Add --help --- parent-urls | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/parent-urls b/parent-urls index 6e961cb..85b89c0 100755 --- a/parent-urls +++ b/parent-urls @@ -1,4 +1,11 @@ #!/bin/bash +if [[ "$1" == '--help' || "$1" == '-h' ]] +then + echo "Usage: parent-urls [--with-original]" >&2 + echo "Take URLs on stdin, remove path components one by one and print the resulting URLs on stdout." >&2 + echo "If --with-original is given, the input URL is printed before the parents." >&2 +fi + prog0='BEGIN { FS="/"; OFS="/" }' # Set the field separators prog1='{ print }' # Print the input URL (if desired) prog2='/\/$/ { --NF }' # Remove the trailing blank field if the URL ends with a slash