empty variable after "read -t" is used

Bug #1085043 reported by Jonas Björk
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bash (Ubuntu)
New
Undecided
Unassigned

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

Tags: bash
Revision history for this message
Jonas Björk (jonasbjork) wrote :

This bug is still present.

$ lsb_release -rd
lsb_release -rd
Description: Ubuntu 14.04 LTS
Release: 14.04

$ apt-cache policy bash
apt-cache policy bash
bash:
  Installed: 4.3-7ubuntu1
  Candidate: 4.3-7ubuntu1
  Version table:
 *** 4.3-7ubuntu1 0
        500 http://se.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     4.3-6ubuntu1 0
        500 http://se.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

tags: added: bash
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.