mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
get-os.sh: Replace cut with bash-internal pattern substitution
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
087e2785fc
commit
bfe28086c7
1 changed files with 7 additions and 6 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
# #
|
# #
|
||||||
# generic utiltiy modules #
|
# generic utiltiy modules #
|
||||||
|
|
@ -104,12 +104,14 @@ cmd_name_version()
|
||||||
|
|
||||||
cmd_version()
|
cmd_version()
|
||||||
{
|
{
|
||||||
cmd_name_version | cut -d- -f2-
|
local nv=`cmd_name_version`
|
||||||
|
echo ${nv#*-}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_name()
|
cmd_name()
|
||||||
{
|
{
|
||||||
cmd_name_version | cut -d- -f1
|
local nv=`cmd_name_version`
|
||||||
|
echo ${nv%%-*}
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- here we go
|
# --- here we go
|
||||||
|
|
@ -118,7 +120,7 @@ myname=`basename $0`
|
||||||
release_file=/etc/os-release
|
release_file=/etc/os-release
|
||||||
cmd=name_version
|
cmd=name_version
|
||||||
|
|
||||||
set -- `getopt 'hvV' $*`
|
eval set -- `getopt -- hvV "$@"`
|
||||||
while [ "$1" != -- ] ; do
|
while [ "$1" != -- ] ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h)
|
-h)
|
||||||
|
|
@ -138,7 +140,6 @@ shift
|
||||||
done
|
done
|
||||||
shift
|
shift
|
||||||
|
|
||||||
[ "$1" ] && cmd="$1"
|
[ "$1" ] && cmd="${1/-/_}"
|
||||||
|
|
||||||
eval cmd_$cmd
|
eval cmd_$cmd
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue