[Bug 1085043] [NEW] empty variable after "read -t" is used

Jonas Björk jonas.bjork at me.com
Fri Nov 30 13:57:13 UTC 2012


Public bug reported:

$ lsb_release -rd
Description:    Ubuntu 12.04.1 LTS
Release:        12.04

$ apt-cache policy bash                            
bash:                                                                   
  Installed: 4.2-2ubuntu2                                               
  Candidate: 4.2-2ubuntu2                                               
  Version table:                                                        
 *** 4.2-2ubuntu2 0                                                     
        500 http://se.archive.ubuntu.com/ubuntu/ precise/main amd64 Pack
ages                                                                    
        100 /var/lib/dpkg/status


When using "read -t" in bash script predefined variable becomes empty. Example:

VAR="jonas"
read -t 3 VAR
echo ${VAR}

When user does not input anything and timeout is passed (3 secs)
variable VAR becomes empty. When doing the same in Mac OSX with:

$ bash --version
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)
Copyright (C) 2007 Free Software Foundation, Inc.

it works as expected as:

$ VAR="jonas"
$ read -t 3 VAR
$ echo ${VAR}
jonas

** Affects: bash (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/1085043

Title:
  empty variable after "read -t" is used

Status in “bash” package in Ubuntu:
  New

Bug description:
  $ lsb_release -rd
  Description:    Ubuntu 12.04.1 LTS
  Release:        12.04

  $ apt-cache policy bash                            
  bash:                                                                   
    Installed: 4.2-2ubuntu2                                               
    Candidate: 4.2-2ubuntu2                                               
    Version table:                                                        
   *** 4.2-2ubuntu2 0                                                     
          500 http://se.archive.ubuntu.com/ubuntu/ precise/main amd64 Pack
  ages                                                                    
          100 /var/lib/dpkg/status

  
  When using "read -t" in bash script predefined variable becomes empty. Example:

  VAR="jonas"
  read -t 3 VAR
  echo ${VAR}

  When user does not input anything and timeout is passed (3 secs)
  variable VAR becomes empty. When doing the same in Mac OSX with:

  $ bash --version
  GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)
  Copyright (C) 2007 Free Software Foundation, Inc.

  it works as expected as:

  $ VAR="jonas"
  $ read -t 3 VAR
  $ echo ${VAR}
  jonas

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




More information about the foundations-bugs mailing list