Dear.
I needed to read 16 bytes from a binary file and tried to replace a hexdump
call with read built-in. I expected that with "-N1" if a NUL character is
encountered bash would assign an empty string, however there's no indication
that a NUL character was there and it simply assigns the next n
SC> 2015-07-01 22:19:10 +0300, Ilya Basin:
>> Hi list.
>>
>> Want to read whole stdin into variable.
>> Don't want to spawn new processes (cat).
SC> [...]
SC> Note that
SC> $( execute /bin/cat in that process, it does the reading (from
SC> file)
Hi list.
Want to read whole stdin into variable.
Don't want to spawn new processes (cat).
Don't want to reopen existing fd &0
First thing I tried: $(<&0)
It silently returns an empty string.
From bash manual:
The command substitution $(cat file) can be replaced by the equivalent but
faster
>
On Wed, Apr 24, 2013 at 7:31 AM, Ilya Basin <[1]basini...@gmail.com>
wrote:
Hi.
$ cat ~/.bashrc
#
# ~/.bashrc
#
echo Im in .bashrc >&2
RHEL 6.0, bash 4.1.2
$ ssh localhost 'ps -f $$ &&
Hi.
$ cat ~/.bashrc
#
# ~/.bashrc
#
echo Im in .bashrc >&2
RHEL 6.0, bash 4.1.2
$ ssh localhost 'ps -f $$ && true'
Im in .bashrc
UIDPID PPID C STIME TTY STAT TIME CMD
git 22295 22294 0 08:29 ?Ss 0:00 bash -c ps -f $$ && true
Hi!
I've got strange behavior. Here's my script:
#!/bin/bash
{
trap '
echo "in trap EXIT">&2
' EXIT
sleep 4 &
echo 'sleep 2'>&2
sleep 2
echo 'wait $!'>&2
wait $!
echo 'exit'>&2
exit
} | cat
If I press
Hi.
I have a script that creates some background tasks.
I want the whole tree to be killed by Ctrl-C.
There's a requirement that the script process and its children must
belong to the same process group. This is why I can't enable job
control.
I don't want to use 'trap', because it adds complexit
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='ba