婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁(yè) > 知識(shí)庫(kù) > shell中長(zhǎng)命令的換行處理方法示例

shell中長(zhǎng)命令的換行處理方法示例

熱門標(biāo)簽:外呼系統(tǒng)的合法性 武漢語(yǔ)音電銷機(jī)器人加盟 房產(chǎn)證地圖標(biāo)注的兩個(gè)面積 同花順電話機(jī)器人微信 北京電銷機(jī)器人對(duì)市場(chǎng)的影響 輝縣市地圖標(biāo)注 湖北孝感如何辦理 地圖標(biāo)注x是啥意思 威海電銷外呼系統(tǒng)好用嗎

前言

考察下面的腳本:

emcc -o ./dist/test.html --shell-file ./tmp.html --source-map-base dist -O3 -g4 --source-map-base dist -s MODULARIZE=1 -s "EXPORT_NAME=\"Test\"" -s USE_SDL=2 -s LEGACY_GL_EMULATION=1 --pre-js ./pre.js --post-js ./post.js --cpuprofiler --memoryprofiler --threadprofilermain.cpp

這里在調(diào)用 emcc 進(jìn)行 WebAssembly 編譯時(shí),組織了很多參數(shù)。整個(gè)命令都在一行之中,不是很好閱讀和維護(hù)。

換行

可通過(guò)加 \ 的方式來(lái)進(jìn)行換行拆分。

改造后看起來(lái)像這樣,一個(gè)參數(shù)占一行:

emcc -o ./dist/test.html\

 --shell-file ./tmp.html\

 --source-map-base dist\

 -O3\

 -g4\

 --source-map-base dist\

 -s MODULARIZE=1\

 -s "EXPORT_NAME=\"Test\""\

 -s USE_SDL=2\

 -s LEGACY_GL_EMULATION=1\

 --pre-js ./pre.js\

 --post-js ./post.js\

 --cpuprofiler\

 --memoryprofiler\

 --threadprofiler\

 main.cpp

注釋

通過(guò) \(backslash) 換行后,整體閱讀體驗(yàn)好了很多。進(jìn)一步,我們想要為每個(gè)參數(shù)添加注釋,發(fā)現(xiàn)不能簡(jiǎn)單地這樣來(lái):

emcc -o ./dist/test.html\ # 目標(biāo)文件
 --shell-file ./tmp.html\ # 模板文件
 --source-map-base dist\

 -O3\

 -g4\

 --source-map-base dist\

 -s MODULARIZE=1\

 -s "EXPORT_NAME=\"Test\""\

 -s USE_SDL=2\

 -s LEGACY_GL_EMULATION=1\

 --pre-js ./pre.js\

 --post-js ./post.js\

 --cpuprofiler\

 --memoryprofiler\

 --threadprofiler\

 main.cpp

這樣會(huì)導(dǎo)致整個(gè) shell 腳本解析失敗。

實(shí)測(cè)發(fā)現(xiàn),也不能這樣:

emcc -o\

 # 目標(biāo)文件
 ./dist/test.html\ 
  # 模板文件
 --shell-file ./tmp.html\

 --source-map-base dist\

 -O3\

 -g4\

 --source-map-base dist\

 -s MODULARIZE=1\

 -s "EXPORT_NAME=\"Test\""\

 -s USE_SDL=2\

 -s LEGACY_GL_EMULATION=1\

 --pre-js ./pre.js\

 --post-js ./post.js\

 --cpuprofiler\

 --memoryprofiler\

 --threadprofiler\

 main.cpp

同樣會(huì)導(dǎo)致解析失敗。

說(shuō)到底,通過(guò) \ 拆分的命令,只是呈現(xiàn)上變成了多行,其中插入的注釋是會(huì)破壞掉語(yǔ)義的。

但也不是沒(méi)辦法添加注釋了,幾經(jīng)周轉(zhuǎn)發(fā)現(xiàn)如下寫法是可行的:

emcc -o ./dist/test.html `# 目標(biāo)文件` \

 --shell-file ./tmp.html `# 模板文件` \

 --source-map-base dist `# source map 根路徑` \

 -O3 `# 優(yōu)化級(jí)別` \

 -g4 `# 生成 debug 信息` \

 --source-map-base dist\

 `# -s MODULARIZE=1\`
 -s "EXPORT_NAME=\"Test\""\

 -s USE_SDL=2\

 -s LEGACY_GL_EMULATION=1\

 --pre-js ./pre.js\

 --post-js ./post.js\

 --cpuprofiler\

 --memoryprofiler\

 --threadprofiler\

 main.cpp

即通過(guò) `(backtick) 來(lái)包裹我們的注釋,就不會(huì)破壞掉腳本的語(yǔ)義了,能夠正確解析執(zhí)行。

進(jìn)一步,解決了注釋的問(wèn)題,如果我們不想要某一行,同時(shí)又不想刪除,可以像下面這樣來(lái)注釋:

emcc -o ./dist/test.html `# 目標(biāo)文件` \

 --shell-file ./tmp.html `# 模板文件` \

 --source-map-base dist `# source map 根路徑` \

 -O3 `# 優(yōu)化級(jí)別` \

 -g4 `# 生成 debug 信息` \

 --source-map-base dist\

 -s MODULARIZE=1\

 -s "EXPORT_NAME=\"Test\""\

 -s USE_SDL=2\

 -s LEGACY_GL_EMULATION=1\

 `# --pre-js ./pre.js`\

 --post-js ./post.js\

 --cpuprofiler\

 `# --threadprofiler`\

 --memoryprofiler\

 main.cpp

總結(jié)

以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)腳本之家的支持。

您可能感興趣的文章:
  • shell腳本echo輸出不換行功能增強(qiáng)實(shí)例
  • PowerShell中刪除空格、點(diǎn)號(hào)、減號(hào)和換行方法代碼實(shí)例
  • PowerShell腳本反引號(hào)用法實(shí)例:隨時(shí)隨地給代碼換行

標(biāo)簽:紹興 武威 蚌埠 西寧 麗江 迪慶 安康 日喀則

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《shell中長(zhǎng)命令的換行處理方法示例》,本文關(guān)鍵詞  shell,中長(zhǎng),命令,的,換行,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《shell中長(zhǎng)命令的換行處理方法示例》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于shell中長(zhǎng)命令的換行處理方法示例的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 即墨市| 凭祥市| 松潘县| 辽宁省| 清流县| 阿尔山市| 舞钢市| 太仓市| 哈密市| 瑞安市| 夏邑县| 定西市| 会宁县| 中牟县| 江陵县| 大埔区| 富宁县| 乌拉特后旗| 武威市| 天柱县| 武功县| 土默特左旗| 馆陶县| 宁阳县| 于田县| 申扎县| 旬阳县| 康定县| 柘城县| 苏尼特右旗| 濉溪县| 翁牛特旗| 襄城县| 山阳县| 凤台县| 繁峙县| 赞皇县| 泗阳县| 义马市| 象州县| 开封市|