document that read built-in can't return zero-length string in the middle of input

2024-01-10 Thread ilya Basin
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

Re[2]: substitution "read all from fd" silently fails: $(<

2015-07-01 Thread Ilya Basin
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)

substitution "read all from fd" silently fails: $(<

2015-07-01 Thread Ilya Basin
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

Re[2]: ~/.bashrc not sourced for ssh commands on Archlinux

2013-04-23 Thread Ilya Basin
> 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 $$ &&

~/.bashrc not sourced for ssh commands on Archlinux

2013-04-23 Thread Ilya Basin
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

trap EXIT in piped subshell not triggered during wait

2013-04-12 Thread Ilya Basin
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

prevent ignore SIGINT for asynchronous commands without enabling job control

2013-04-10 Thread Ilya Basin
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

bug or feature? Ctrl+C sometimes can't interrupt a loop with multiple enclosed pipes

2010-06-28 Thread Ilya Basin
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