bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'exec' produced internal code output instead of normal


From: Alex fxmbsw7 Ratchev
Subject: Re: 'exec' produced internal code output instead of normal
Date: Sun, 14 Mar 2021 15:40:26 +0100

thank you sir
theres a misunderstanding tho
with exec i meant i exec socat instead of without exec

i may be able to reproduce it soon as i need to extend my softwares

peace

On Sun, Mar 14, 2021 at 3:37 PM Dale R. Worley <worley@alum.mit.edu> wrote:

> > 2021年3月13日(土) 8:06 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>:
> >> but using it resulted sometimes output of code of the script in the
> output
> >> of the files
> >> removing exec made it work normally as supposed
>
> One possibility is a typo, using "<<" rather than "<".
>
> Koichi Murase <myoga.murase@gmail.com> writes:
> > I don't know about `socat', but maybe it's just the file descriptor
> > collision. One needs to make sure that the file descriptor is not yet
> > used when a new file descriptor is opened. For example, in Bash
> > scripts, one should use the file descriptor 3--9 if you manually
> > specify it because the file descriptors larger than 9 may be already
> > used for other purposes.
>
> bash has the useful ability to select an unused file descriptor, such as
>
>     exec {new_descr}>wherever
>
> That opens the file "wherever" for writing on some previously closed
> file descriptor and assigns the number to the variable "new_descr".
> After that you can do
>
>    echo >&$new_descr
>
> etc.
>
> Dale
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]