From: Milian Wolff Date: Thu, 2 Jun 2016 10:01:29 +0000 (+0200) Subject: Improve bash compatibility of heaptrack shell script. X-Git-Tag: submit/tizen/20180620.112952^2~175 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f92df68b41b9aaa10b431d5d4f52caae266c5b0c;p=sdk%2Ftools%2Fheaptrack.git Improve bash compatibility of heaptrack shell script. - don't use case fall-through via ;;& - access /proc/$pid/comm directly --- diff --git a/heaptrack.sh.cmake b/heaptrack.sh.cmake index e8f7f2b..20151fc 100755 --- a/heaptrack.sh.cmake +++ b/heaptrack.sh.cmake @@ -59,24 +59,21 @@ client= while true; do case "$1" in - "-d") ;& - "--debug") + "-d" | "--debug") debug=1 shift 1 ;; - "-h") ;& - "--help") + "-h" | "--help") usage exit 0 ;; - "-p") ;& - "--pid") + "-p" | "--pid") pid=$2 if [ -z "$pid" ]; then echo "Missing PID argument." exit 1 fi - client=$(ps --no-headers -c -o comm -p $pid) + client=$(cat /proc/$pid/comm) if [ -z "$client" ]; then echo "Cannot attach to unknown process with PID $pid." exit 1 @@ -89,8 +86,7 @@ while true; do fi break ;; - "-v") ;& - "--version") + "-v" | "--version") echo "heaptrack @HEAPTRACK_VERSION_MAJOR@.@HEAPTRACK_VERSION_MINOR@.@HEAPTRACK_VERSION_PATCH@" exit 0 ;;