Size: a a a

2021 February 10

EN

Evgeniy Naumov in pro.bash
но все равно неожиданно. я видимо раньше в файл складывал. а потом из него в цикл пулял... давно не доставал while... спасибо
источник

∀lǝxǝʎ in pro.bash
Можно так:
done < <(ls...)
источник

∀lǝxǝʎ in pro.bash
∀lǝxǝʎ
Можно так:
done < <(ls...)
Между угловыми скобками пробел!
источник

VP

Vadim "Oxyd&quo... in pro.bash
∀lǝxǝʎ
1. File redirect
2. Here document
3. Here string
Так. А here document это шо?
источник

∀lǝxǝʎ in pro.bash
Vadim "Oxyd" Priluzkiy
Так. А here document это шо?
<<
источник

∀lǝxǝʎ in pro.bash
Ваш, Кэп! 😉
источник

VP

Vadim "Oxyd&quo... in pro.bash
Я понял что джве скобки, я про сам here document. Чем он остальных двух отличается?
источник

VP

Vadim "Oxyd&quo... in pro.bash
Я не помню чтоб я его применял...
источник

∀lǝxǝʎ in pro.bash
не, ну они все три про разные способы подачи инфы
могу кнеч man покопировать
источник

VP

Vadim "Oxyd&quo... in pro.bash
∀lǝxǝʎ
не, ну они все три про разные способы подачи инфы
могу кнеч man покопировать
Ну одна — из файла брать, три, из строки или результата работы сабшелла, а две?
источник

∀lǝxǝʎ in pro.bash
Пример:
cat >someconfig.conf <<-EOF
first line
second line
--address ${address}
EOF
источник

∀lǝxǝʎ in pro.bash
   Here Documents
      This type of redirection instructs the shell to read input from the current source until a line containing only delimiter (with no trailing blanks) is seen.  All of the lines read up to that point are then used as  the  standard  input  (or
      file descriptor n if n is specified) for a command.

      The format of here-documents is:

             [n]<<[-]word
                     here-document
             delimiter

      No  parameter  and  variable expansion, command substitution, arithmetic expansion, or pathname expansion is performed on word.  If any part of word is quoted, the delimiter is the result of quote removal on word, and the lines in the here-
      document are not expanded.  If word is unquoted, all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion, the character sequence \<newline> is ignored, and \ must be used to  quote
      the characters \, $, and `.

      If the redirection operator is <<-, then all leading tab characters are stripped from input lines and the line containing delimiter.  This allows here-documents within shell scripts to be indented in a natural fashion.
источник

V

Vikentsi in pro.bash
Vadim "Oxyd" Priluzkiy
Я не помню чтоб я его применял...
Templating вполне норм способ
источник

VP

Vadim "Oxyd&quo... in pro.bash
∀lǝxǝʎ
   Here Documents
      This type of redirection instructs the shell to read input from the current source until a line containing only delimiter (with no trailing blanks) is seen.  All of the lines read up to that point are then used as  the  standard  input  (or
      file descriptor n if n is specified) for a command.

      The format of here-documents is:

             [n]<<[-]word
                     here-document
             delimiter

      No  parameter  and  variable expansion, command substitution, arithmetic expansion, or pathname expansion is performed on word.  If any part of word is quoted, the delimiter is the result of quote removal on word, and the lines in the here-
      document are not expanded.  If word is unquoted, all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion, the character sequence \<newline> is ignored, and \ must be used to  quote
      the characters \, $, and `.

      If the redirection operator is <<-, then all leading tab characters are stripped from input lines and the line containing delimiter.  This allows here-documents within shell scripts to be indented in a natural fashion.
А... Всё, врубился. Я этим оказывается пользуюсь, но редко.
источник

AG

Artemy Gevorkov in pro.bash
Vadim "Oxyd" Priluzkiy
А... Всё, врубился. Я этим оказывается пользуюсь, но редко.
Я этим постоянно пользуюсь, когда пишу usage для скриптов.
источник

A

Alex in pro.bash
всем привет
ребятки подскажите тру способ считывания и обработки аргументов
источник

V

Vikentsi in pro.bash
а нет его :) смотря каких аргументов? Вид их и форма?
источник

A

Alex in pro.bash
нужно написать скрипт который будет читать аргументы и потом запускать другие скрипты с считанными аргументами
если коротко
источник

V

Vikentsi in pro.bash
Alex
нужно написать скрипт который будет читать аргументы и потом запускать другие скрипты с считанными аргументами
если коротко
формат аргументов.  script.sh -р -b
script.sh --print --beging
script.sh vm list vm_name
script.sh vm start vm_name
script.sh 1 2 3
источник

V

Vikentsi in pro.bash
те для начала определится как они будут выглядеть. А потом уже обрабатывать их внутри скрипта в параметрах
$1
$2
$3 и так далее
в зависимости от формата можно глянуть на getopt и getopts
либо свое что-то городить.
Возможно есть и другие готовые типа библиотеки для работы с аргуменами
источник