※ 引述《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/!!/#!/'
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.35.197.159