[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bash interprets $! as an event
From: |
jeremy |
Subject: |
Bash interprets $! as an event |
Date: |
Tue, 27 Jul 2010 12:01:23 -0600 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 -Wall
uname output: Linux figment 2.6.32-24-server #38-Ubuntu SMP Mon Jul 5 10:29:32
UTC 2010 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.1
Patch Level: 5
Release Status: release
Description:
Event-catching seems to be catching cases it shouldn't. In particular, $! is
caught as an event.
Repeat-By:
This command fails as follows:
> nickurak@woking:~$ sleep 5 & PID=$!; echo "pid is $PID"
> bash: !: event not found
Adding quotation marks doesn't help:
> nickurak@woking:~$ sleep 5 & PID="$!"; echo "pid is $PID"
> bash: !": event not found
As a workaround, adding whitespace after the ! fixes it:
> nickurak@woking:~$ sleep 5 & PID=$! ; echo "pid is $PID"
> [1] 1614
> pid is 1614
or
> nickurak@woking:~$ sleep 5 & PID="$! "; echo "pid is $PID"
> [3] 2048
> pid is 2048
- Bash interprets $! as an event,
jeremy <=