Без причудливых монтирований gvfs или sshfs вам нужно использовать sftp-клиент. Я выбираю lftp
>=4.7, потому что он работает с каналами FIFO (scp
, а sftp
— нет ).
Работает с bash
в Linux:
tar --exclude='./somefolder' -zc. \
| tee >(lftp -c 'connect sftp://user:pass@server/path/ ;put /dev/stdin -o sth.tar.gz;') \
| sha256sum
В качестве альтернативы можно использовать ssh
клиент (внешние скобки, необходимые для интерактивной аутентификации по паролю):
(tar --exclude='./somefolder' -zc. \
| tee >(ssh user@server "cat > /path/sth.tar.gz") \
| sha256sum)
Заметьте, tee's
аргумент тоже выглядит немного экзотично, но это не -переносимая bash
магия, позволяющая избежать дополнительных mkfifo
команд, объясненных вman bash
:
Process Substitution
Process substitution is supported on systems that support named pipes (FIFOs) or the /dev/fd method of naming open files. It takes the form of <(list) or >(list). The process list is run with its input or output connected to a FIFO or some file in /dev/fd. The name of this file is passed as an argument to the current command as the result of the expansion. If the >(list) form is used, writing to the file will provide input for list. If the <(list) form is used, the file passed as an argument should be read to obtain the output of list.
xargs
не поддерживает два заполнителя.
Используйте цикл for. На самом деле, два цикла (один для имен файлов и один для последовательности 12..14 ).
Например:
#!/bin/bash
for f in barcode0[1-4].fastq; do
bn="$(basename "$f".fastq)"
for k in {12..14}; do
krocus --verbose --output_file "out_krocus/${bn}_${k}Ecoli1.txt" \
/nexusb/Gridion/MLST_krocus_DBs/e_coli1 --kmer "$k" "$f"
done
done
При использовании GNU Parallel это выглядит так:
parallel krocus --verbose --output_file out_krocus/{1.}_{2}Ecoli1.txt /nexusb/Gridion/MLST_krocus_DBs/e_coli1 --kmer {2} {1} ::: barcode0[1-4].fastq ::: {12..14}