What the -b option does in SFTP

I am looking through some old shell scripts, and there is a line that I don't quite understand:

~]$ sftp -b /dev/fd/3 dropuser@targetftpserver.company.com

I see from the man file that -b is for the batch, and that the argument should be a batch file.

In this case, it looks like the batch file should be on / dev / fd / 3 - the floppy disk? I don't seem to understand.

Any ideas what this should do?

+5
source share
2 answers

Files "/dev/fd*"are special devices. In fact, they do not take up so much space in your system. They allow the process of accessing file descriptors by number; 0,1,2are standard input, standard outputand standard error, and other open files begin with3

sftp -b /dev/fd/3

:

[root@04 fd]# exec 3< /etc/resolv.conf
[root@04 fd]# cat /dev/fd/3
search example.com 

nameserver 10.10.10.10
nameserver 20.20.20.20

read

[root@04 fd]# read -u 3 a b
[root@04 fd]# echo $a $b
nameserver 10.10.10.10

/dev/fd directoy

[root@04 fd]# ls -l /dev/fd/
total 0
lrwx------ 1 root root 64 Feb 20 14:34 0 -> /dev/pts/0
lrwx------ 1 root root 64 Feb 20 14:34 1 -> /dev/pts/0
lrwx------ 1 root root 64 Feb 20 14:34 2 -> /dev/pts/0
lr-x------ 1 root root 64 Feb 20 14:34 3 -> /etc/resolv.conf

.

+3

/dev/fd - - "fd" " ". man fd .

: http://lists.apple.com/archives/darwinos-users/2004/Apr/msg00042.html. , SFTP, (, , ?), .

script SFTP, , . , , script, /dev/fd/ 3 SFTP , .

+3

All Articles