作者: mankowk 時間: 2020-3-27 18:47 標題: 請教 linux shell bash, 帶variable 入 function...
本帖最後由 mankowk 於 2020-3-27 19:24 編輯
.....[ sorry, 發錯區..........我已在 (程式編寫) 重發 “............
https://www.hkepc.com/forum/view ... =2553961&extra=
用 bash
帶個 variable 入 function
因為會帶唔同既 variable 入去,
所以唔可以在 function 入面寫死個 variable.
想run 完 function 之後, 原本帶果個 variable 要改變...
請教師兄們, 要加邊句 code?
謝謝
- #!/bin/bash
- tag1="hello"
- changeword() {
- tag2=$1"9999"
- ......想將 tag2 個結果, 改變原本帶入黎既 tag1........
- }
- changeword $tag1
- echo $tag1
- 想結果出 hello9999
作者: samiux 時間: 2020-3-27 20:13
.....[ sorry, 發錯區..........我已在 (程式編寫) 重發 “............
用 bash
帶個 variable 入 func ...
mankowk 發表於 2020-3-27 18:47
https://linuxize.com/post/bash-functions/
via HKEPC IR Pro 3.6.1 - Android(3.3.1)

