Skip to content

Commit 07fea0c

Browse files
committed
好耶,bash 再短一点
1 parent b465b34 commit 07fea0c

File tree

3 files changed

+4
-18
lines changed

3 files changed

+4
-18
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
| 2 | [bakashigure](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/bakashigure) | 33 Bytes | PHP | 狗都不写PHP |
2727
| 3 | [nocat](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/nocat) | 36 Bytes | PHP | make PHP greate again!|
2828
| 4 | [MoTIEdsuNe](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/MoTIEdsuNe)| 85 Bytes | Ruby | 大概还能再压,但是懒 |
29-
| 5 | [MistEO](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/misteo) | 103 Bytes | Bash | 好耶又超过鼹鼠了 |
29+
| 5 | [MistEO](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/misteo) | 91 Bytes | Bash | 好耶又超过鼹鼠了 |
3030
| 6 | [鼹鼠](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/%E9%BC%B9%E9%BC%A0) | 103 Bytes | JavaScript | 不能被玛丽这么轻松就 |
3131
| 7 | [FiveYellowMice](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/FiveYellowMice) | 111 bytes | Ruby | 大概还能再压,但是懒 |
3232
| 8 | [Jack-Works](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/Jack-Works) | 126 bytes | JavaScript | |

misteo/README.md

+2-16
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,11 @@ bash ./misteo.bash
99
然后终端里直接输入会有字符转义问题,所以要多加几个转义符 `\`, 下面这个是可以直接复制粘贴运行的版本
1010

1111
```bash
12-
tr -d \\`tr %-t \!-t<<<r`<<<`tr \!-t /-t<<<:;tr \!-/ d-t<<<'")),'`,\ `tr /-t +-t<<<[;tr \!-/ d-t<<<',/)'`d!
12+
tr t t<<<$(tr \!-t /-t<<<:)$(tr \!-/ d-t<<<'")),'),\ $(tr /-t +-t<<<[)$(tr \!-/ d-t<<<',/)')d!
1313
```
1414

1515
## 简单解释
1616

1717
[tr 命令](https://www.runoob.com/linux/linux-comm-tr.html)
1818

19-
`tr \!-t /-t<<<:` 这个把 `:` 转换成 `H``tr ,-t --t<<<d``d` 转换成 `e`,后面都是同理,熟悉下 tr 命令应该比较好理解
20-
21-
但麻烦的是,每个 tr 命令都是带换行的,也就是输出结果会是这样的:
22-
23-
```txt
24-
H
25-
e
26-
l
27-
l
28-
o
29-
```
30-
31-
那么问题变成了怎么删掉换行
32-
33-
于是同样的手法,拼出来一个 `n` : `tr %-t \!-t<<<r`,在加上 `\\` 就是 `\n` 了,再结合 `tr``-d` 参数(删除某字符),就完成啦
19+
`tr \!-t /-t<<<:` 这个把 `:` 转换成 `H``tr ,-t --t<<<d``d` 转换成 `e`,后面都是同理

misteo/misteo.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
tr -d \\`tr %-t !-t<<<r`<<<`tr !-t /-t<<<:;tr !-/ d-t<<<'")),'`,\ `tr /-t +-t<<<[;tr !-/ d-t<<<',/)'`d!
1+
tr t t<<<$(tr !-t /-t<<<:)$(tr !-/ d-t<<<'")),'),\ $(tr /-t +-t<<<[)$(tr !-/ d-t<<<',/)')d!

0 commit comments

Comments
 (0)