如何移除 shell script 的註解 - Linux
By Zora
at 2010-06-20T01:59
at 2010-06-20T01:59
Table of Contents
※ 引述《hjklzxcv (none)》之銘言:
: hi all
: 在此的 shell script 是指 sh 與 bash 所撰寫的 script
: 一般註解的形式為 # xxxx
: 想請教是否有類似 strip 的工具
: 可以將 script 內的註解,正確的移除掉
: 以 sh17.sh 為例 http://tinyurl.com/2c8duyz
: 保留 #!/bin/bash ,移除中英文註解
cat sh18.sh | sed '/#[a-z,A-Z, ]/d'
cat sh18.sh | sed '/# /d'
cat sh18.sh | sed -e 's/#!/!!/' -e '/#/d' -e 's/!!/#!/'
--
: hi all
: 在此的 shell script 是指 sh 與 bash 所撰寫的 script
: 一般註解的形式為 # xxxx
: 想請教是否有類似 strip 的工具
: 可以將 script 內的註解,正確的移除掉
: 以 sh17.sh 為例 http://tinyurl.com/2c8duyz
: 保留 #!/bin/bash ,移除中英文註解
cat sh18.sh | sed '/#[a-z,A-Z, ]/d'
cat sh18.sh | sed '/# /d'
cat sh18.sh | sed -e 's/#!/!!/' -e '/#/d' -e 's/!!/#!/'
--
Tags:
Linux
All Comments
Related Posts
Kubuntu 10.04使用心得
By Hamiltion
at 2010-06-20T00:20
at 2010-06-20T00:20
如何移除 shell script 的註解
By Hazel
at 2010-06-20T00:15
at 2010-06-20T00:15
請教我Linux.....
By Sarah
at 2010-06-20T00:00
at 2010-06-20T00:00
請教我Linux.....
By Anonymous
at 2010-06-19T19:40
at 2010-06-19T19:40
XModifierKeymap ??
By Freda
at 2010-06-19T16:49
at 2010-06-19T16:49