I file "/dev/fd*"
sono dispositivi speciali. In realtà non occupano molto spazio sul tuo sistema. Consentono a un processo di accedere ai descrittori di file in base al numero; 0,1,2
sono di serie input
, standard output
e standard error
, e altri file aperti Iniziamo con 3
Nel tuo caso sftp
utilizzando -b
leggere comando da /dev/fd/3
Esempio:
[[email protected] fd]# exec 3< /etc/resolv.conf
[[email protected] fd]# cat /dev/fd/3
search example.com
nameserver 10.10.10.10
nameserver 20.20.20.20
È possibile leggere i dati utilizzando read
comando
[[email protected] fd]# read -u 3 a b
[[email protected] fd]# echo $a $b
nameserver 10.10.10.10
uscita del /dev/fd
Directoy
[[email protected] 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
Note: Nel tuo caso che file di input potrebbe essere diversa