Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: <(cat) doesn't work but =(cat) does ?



On Fri, Sep 26, 2008 at 07:30:52PM +0200, Louis-David Mitterrand wrote:
> Hi,
> 
> when trying this:
> 
> 	% ssh remotehost "transmission-remote -a <(cat)" < ~/torrent.file
> 
> I get this error:
> 
> 	Couldn't read "/proc/self/fd/11": Not a regular file
> 	Couldn't add file: /proc/self/fd/11

That's a problem with "transmission-remote". It expects a
regular file and <(cat) is a pipe (transmission-remote and cat
run concurrently). It's the same as:

ssh remotehost "cat | transmission-remote -a /dev/stdin" < ~/torrent.file

You could have done 

ssh remotehost "transmission-remote -a /dev/stdin" < ~/torrent.file

In which case it would probably have been a pipe as well.

$ ssh localhost lsof -ac lsof -d0
Password:
COMMAND   PID     USER   FD   TYPE DEVICE SIZE  NODE NAME
lsof    13428 chazelas    0r  FIFO    0,6      66743 pipe

> However when using:
> 
> 	% ssh remotehost "transmission-remote -a =(cat)" < ~/torrent.file
> 
> all is well.
[...]

Here, zsh creates a temp file. cat and transmission-remote are
run sequencially (zsh waits for cat to finish fill up the temp
file and then runs transmission-remote with that temp file name
as argument), it's the same as

ssh remotehost "cat > tempfile; transmission -a tempfile" < ~/torrent.file

-- 
Stéphane



Messages sorted by: Reverse Date, Date, Thread, Author