File: string.sh

package info (click to toggle)
saunafs 5.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,820 kB
  • sloc: cpp: 109,287; sh: 18,755; python: 4,737; ansic: 4,023; makefile: 60; awk: 17
file content (15 lines) | stat: -rw-r--r-- 407 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# remove leading and trailing whitespaces
function trim {
	sed -e 's/^[ \t]*//' -e 's/[ \t]*$//'
}

# remove leading and trailing whitespaces and replace
# remaining multiple whitespaces with a single space
function trim_hard {
	trim | sed -e 's/[ \t]\+/ /g'
}

function version_compare_gte() {
   sort_result=$(echo -e "${1}\n${2}" | sort -t '.' -k 1,1 -k 2,2 -g | head -n1)
   [ "$2" = "$sort_result" ]
}