美文网首页
2020-10-27 shell note1

2020-10-27 shell note1

作者: cityhash123 | 来源:发表于2020-10-27 22:44 被阅读0次

echo 转义字符输出

$ echo "a\tb\tc"
a\tb\tc
$ echo -e "a\tb\tc"
a b c

tr 用法

$ echo -e "a\tb\tc" | tr "\t" "-"
a-b-c

tr 删除 和 替换

$ echo '["a","b","c","d"]'
["a","b","c","d"]
$ echo '["a","b","c","d"]' | tr -d ']"[' | tr "," "\n"
a
b
c
d

printf vs echo 格式化输出

$ for i in $(seq 4); do printf '%s\n' $i;done
1
2
3
4

相关文章

网友评论

      本文标题:2020-10-27 shell note1

      本文链接:https://www.haomeiwen.com/subject/xsufvktx.html