我有以下文件
#+BEGIN_SRC shell
ls | head -15
#+END_SRC
#+RESULTS:
| 00.contents.org |
| 00.preface.html |
| C_Programming_Language_split_011.html |
| C_Programming_Language_split_012.html |
| C_Programming_Language_split_013.html |
| C_Programming_Language_split_014.html |
| C_Programming_Language_split_015.html |
| C_Programming_Language_split_016.html |
| C_Programming_Language_split_017.html |
| C_Programming_Language_split_018.html |
| C_Programming_Language_split_019.html |
| C_Programming_Language_split_020.html |
| C_Programming_Language_split_021.html |
| C_Programming_Language_split_022.html |
| C_Programming_Language_split_023.html |
我计划将 011 连接到 019,并尝试
#+BEGIN_SRC shell :results output
ls C_Programming_Language_split_0[11-19].html
#+END_SRC
报告错误:
ls: cannot access 'C_Programming_Language_split_0[11-19].html': No such file or directory
怎样才能完成呢?
答案1
你需要括号扩展代替[11-19]
ls C_Programming_Language_split_0{11..19}.html
或者
ls C_Programming_Language_split_{011..019}.html
[11-19]
是一个 glob 表达式,它匹配单个字符,或者从到1
范围内的字符,或者(因此或)。1
1
9
1
9