mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
27 lines
349 B
Bash
Executable file
27 lines
349 B
Bash
Executable file
#!/usr/local/plan9/bin/rc
|
|
|
|
if(! ~ $#* 2){
|
|
echo 'usage: netput system path' >[1=2]
|
|
exit usage
|
|
}
|
|
|
|
f=putfile
|
|
ns=`{namespace}
|
|
if(u test -S $ns/$1)
|
|
f=$f^9p
|
|
|
|
t=/tmp/netget.$pid.$USER
|
|
fn sigexit { rm -f $t }
|
|
|
|
fn putfile{
|
|
cat >$t
|
|
if(! echo put $t $2 | sftp -b - $1 >/dev/null)
|
|
exit 1
|
|
}
|
|
fn putfile9p{
|
|
if(! 9p write $1/$2)
|
|
exit 1
|
|
}
|
|
|
|
$f $1 $2
|
|
exit 0
|