加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

bash – 在Emacs中的脚本中着色/缩进脚本

发布时间:2020-12-15 22:36:28 所属栏目:安全 来源:网络整理
导读:我经常有 shell脚本调用其他脚本语言,如下所示: #!/bin/bashcat somefile|awk 'BEGIN{ #This line is not auto-indented and is colored as a string constant. ...}{ #Same with this line. ...}'echo "More Bash code here."... 有没有办法让Emacs将awk字
我经常有 shell脚本调用其他脚本语言,如下所示:


#!/bin/bash
cat somefile|awk '
BEGIN
{
  #This line is not auto-indented and is colored as a string constant.
  ...
}
{
  #Same with this line.
  ...
}'

echo "More Bash code here."
...

有没有办法让Emacs将awk字符串识别为awk程序而不仅仅是字符串常量?

解决方法

您需要对现有的emacs lisp文件进行自己的扩展.这是一个学习emacs lisp的有用教程:
http://www.gnu.org/software/emacs/emacs-lisp-intro/

这是一个为html着色的.el文件的示例:
http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el

完成后,将其发布在线,以便其他人可以受益!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读