SORU
1 Mart 2012, PERŞEMBE


Nasıl Satır Çok Satırlı Komut bir Yorum Koymak için

Bash komut çoklu çizgi komut yazmak için nasıl biliyorum, ama nasıl Çok Satırlı komut her satırı için yorum ekleyebilir miyim?

CommandName InputFiles      \ # This is the comment for the 1st line
            --option1 arg1  \ # This is the comment for the 2nd line
            --option2 arg2    # This is the comment for the 3nd line

Ama ne yazık ki, \ devam karakteri sonra yorum komutu kesilir.

CEVAP
9 EKİM 2012, Salı


Ben böyle severim. Aslında bash. backtick kullanarak command substitution Eğer çizgiler arasında bölünmüş ise bile bu açıklamalar herhangi bir yerde uzun bir komut satırı boyunca yerleştirebilirsiniz. Örnek yürütme ve nasıl çalıştığını görmek için örnek önünde echo komutu koydum.

echo CommandName InputFiles `#1st comment` \
             --option1 arg1 `#2nd comment` \
             --option2 arg2 `#3rd comment`

Başka bir örnek, bir satır üzerinde farklı noktalarda birden fazla yorum koy.

some_cmd --opt1 `#1st comment` --opt2 `#2nd comment` --opt3 `#3rd comment`

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • HowcastFoodDrink

    HowcastFoodD

    21 EYLÜL 2010
  • Jeremy Gallman

    Jeremy Gallm

    11 NİSAN 2012
  • SerienTrailerMP

    SerienTraile

    7 HAZİRAN 2012