Can you explain the following code please (assume that HOST contains a string):
HOST=${HOST//$'\n'/}
If the above line was declared inside a function, would the variable "HOST" be available to other functions in the same script?
According to Substring Replacement subchapter from the ABS guide:
HOST=${HOST//$'\n'/}
removes all occurrences of the newline character $'\n' in the HOST variable.
If the above line was declared inside a function, would the variable
HOSTbe available to other functions in the same script?
Yes, assuming HOST wasn't declared using bash local keyword.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With