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

2021-03-14 Thread Alex fxmbsw7 Ratchev
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  wrote:

> > 2021年3月13日(土) 8:06 Alex fxmbsw7 Ratchev :
> >> 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  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
>


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

2021-03-14 Thread Dale R. Worley
> 2021年3月13日(土) 8:06 Alex fxmbsw7 Ratchev :
>> 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  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