Brian Murray (brian-murray)
It's tested other man on ubuntu 20.04 x64 and apple mac pro with m1 pro CPU.
GNU bash, version 5.1.16(1)-release (aarch64-apple-darwin21.1.0)
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
I will test it from lubuntu 20.04 x64 livecd and will add new results.

...
Tested on Lubuntu 20.04, results are the same.
https://sun9-21.userapi.com/impg/epKIlh1A6x-RtHgZ5EUERBK59vFYIAJcg_c3YQ/7iW2z_L1Ajc.jpg?size=1063x500&quality=95&sign=cae5f41c4a9a41ffc7d0ad65bde94db8&type=album

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/1958060

Title:
  bash returns wrong variable value/call more proccesses?

Status in bash package in Ubuntu:
  Incomplete

Bug description:
  Simple function gives different results when interpretator set in first 
string of script
  CHECKPROC()
  {
  i=$(ps aux | grep -c $0)
  ps aux | grep -c $0
  echo variable is $i
  sleep 10
  }
  CHECKPROC

  Expected
  In any conditions it will return same values, then will increments when other 
copies of script  will be found in proccesses list.

  Happened.
  We set interpretator with #!/bin/bash or #!/bin/sh in first string of script 
and runs multiple copies of script from one terminal with & after scriptname. 
It's returns "1" and "variable is 1" always.
  Without interpretator setup, when string #!/bin/bash or #!/bin/sh deleted.
  Run multiple copies scriptname.sh&
  On every iteration it returns right first value and "variable is $value+1"

  $scriptname.sh&
  2
  variable is 3
  $scriptname.sh&
  3
  variable is 4
  ...and so on.

  Without counting in first case it returns only string with grep, in
  second case -- one more string with different PID and script name when
  called from i=$(...) or i=`...`

  
  Ubuntu 14.04 x32, bash 4.3.11(1)-release
  Same results from other man on
  GNU bash, version 5.1.16(1)-release (aarch64-apple-darwin21.1.0)
  GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)

  
  lsb_release -rd
  Description:  Ubuntu 14.04.6 LTS
  Release:      14.04

  apt-cache policy bash
  bash:
    Установлен: 4.3-7ubuntu1.7
    Кандидат:   4.3-7ubuntu1.7
    Таблица версий:
       4.3-7ubuntu1.8+esm1 0
         -32768 https://esm.ubuntu.com/ubuntu/ trusty-infra-security/main i386 
Packages
   *** 4.3-7ubuntu1.7 0
          500 http://ru.archive.ubuntu.com/ubuntu/ trusty-updates/main i386 
Packages
          500 http://security.ubuntu.com/ubuntu/ trusty-security/main i386 
Packages
          100 /var/lib/dpkg/status
       4.3-6ubuntu1 0
          500 http://ru.archive.ubuntu.com/ubuntu/ trusty/main i386 Packages

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1958060/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to