請教 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?
謝謝
  1. #!/bin/bash

  2. tag1="hello"

  3. changeword() {
  4.         tag2=$1"9999"
  5.         ......想將 tag2 個結果, 改變原本帶入黎既 tag1........
  6. }

  7. changeword $tag1
  8. echo $tag1


  9. 想結果出 hello9999
複製代碼

.....[ 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)

TOP