1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/scrumblr_ynh.git synced 2024-09-03 20:16:29 +02:00

Create .fonctions

This commit is contained in:
frju365 2017-02-11 21:24:02 +01:00 committed by GitHub
parent 5b643c1827
commit 4ac32d5dee

16
scripts/.fonctions Normal file
View file

@ -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