poem.sh

来自「Shall高级编程」· Shell 代码 · 共 35 行

SH
35
字号
#!/bin/bash# poem.sh: Pretty-prints one of the document author's favorite poems.# Lines of the poem (single stanza).Line[1]="I do not know which to prefer,"Line[2]="The beauty of inflections"Line[3]="Or the beauty of innuendoes,"Line[4]="The blackbird whistling"Line[5]="Or just after."# Attribution.Attrib[1]=" Wallace Stevens"Attrib[2]="\"Thirteen Ways of Looking at a Blackbird\""# This poem is in the Public Domain (copyright expired).echofor index in 1 2 3 4 5    # Five lines.do  printf "     %s\n" "${Line[index]}"donefor index in 1 2          # Two attribution lines.do  printf "          %s\n" "${Attrib[index]}"doneechoexit 0# Exercise:# --------# Modify this script to pretty-print a poem from a text data file.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?