mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +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 #
|
||||
|
|
@ -104,12 +104,14 @@ cmd_name_version()
|
|||
|
||||
cmd_version()
|
||||
{
|
||||
cmd_name_version | cut -d- -f2-
|
||||
local nv=`cmd_name_version`
|
||||
echo ${nv#*-}
|
||||
}
|
||||
|
||||
cmd_name()
|
||||
{
|
||||
cmd_name_version | cut -d- -f1
|
||||
local nv=`cmd_name_version`
|
||||
echo ${nv%%-*}
|
||||
}
|
||||
|
||||
# --- here we go
|
||||
|
|
@ -118,7 +120,7 @@ myname=`basename $0`
|
|||
release_file=/etc/os-release
|
||||
cmd=name_version
|
||||
|
||||
set -- `getopt 'hvV' $*`
|
||||
eval set -- `getopt -- hvV "$@"`
|
||||
while [ "$1" != -- ] ; do
|
||||
case "$1" in
|
||||
-h)
|
||||
|
|
@ -138,7 +140,6 @@ shift
|
|||
done
|
||||
shift
|
||||
|
||||
[ "$1" ] && cmd="$1"
|
||||
[ "$1" ] && cmd="${1/-/_}"
|
||||
|
||||
eval cmd_$cmd
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue