Перевод оператора Bash Fish

Почему не просто,

while [ 1 ]; do COMMAND || break; done;

Или при использовании в сценарии

#!/bin/bash
while [ 1 ]; do
  # ctrl+c terminates COMMAND and exits the while loop
  # (assuming COMMAND responds to ctrl+c)
  COMMAND || break
done;
3
14.08.2019, 20:10
1 ответ

Оператор <<<представляет собой здесь -строку

3.6.7 Здесь строки

Дано:

[n]<<< word

The word undergoes brace expansion, tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, and quote removal. Pathname expansion and word splitting are not performed. The result is supplied as a single string, with a newline appended, to the command on its standard input (or file descriptor n if n is specified).

Чтобы перевести это на "рыбьи раковины", вы, вероятно, могли бы сделать:

echo '{"some": "xyz"}' | jq

(который будет работать и в bash)

5
27.01.2020, 21:15

Теги

Похожие вопросы