mirror of
https://github.com/YunoHost-Apps/garradin_ynh.git
synced 2024-09-03 18:36:17 +02:00
Create .fonctions
This commit is contained in:
parent
a0821a1bba
commit
aefece1d13
1 changed files with 13 additions and 0 deletions
13
scripts/.fonctions
Normal file
13
scripts/.fonctions
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/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
|
||||
}
|
Loading…
Add table
Reference in a new issue