From 4ac32d5deed3aaa9b1b8d1a53f315f86aaf139de Mon Sep 17 00:00:00 2001 From: frju365 Date: Sat, 11 Feb 2017 21:24:02 +0100 Subject: [PATCH] Create .fonctions --- scripts/.fonctions | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scripts/.fonctions diff --git a/scripts/.fonctions b/scripts/.fonctions new file mode 100644 index 0000000..a654496 --- /dev/null +++ b/scripts/.fonctions @@ -0,0 +1,16 @@ +#!/bin/bash + +ynh_normalize_url_path () { + path=$1 + test -n "$path" || ynh_die "ynh_normalize_url_path expect a URL path as first argument and received nothing." + if [ "${path:0:1}" != "/" ]; then # If the first character is not a / + path="/$path" # Add / at begin of path variable + fi + if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then # If the last character is a / and that not the only character. + path="${path:0:${#path}-1}" # Delete the last character + fi + echo $path +} + + Contact GitHub API Training Shop Blog About +