regex - What does this BASH shell script excerpt do? -


can explain following code please (assume host contains string):

host=${host//$'\n'/} 

if above line declared inside function, variable "host" available other functions in same script?

according substring replacement subchapter abs guide:

host=${host//$'\n'/} 

removes all occurrences of newline character $'\n' in host variable.

if above line declared inside function, variable host available other functions in same script?

yes, assuming host wasn't declared using bash local keyword.


Comments

Popular posts from this blog

javascript - How to diff two immutable objects -

c# - How can I have the VS Debugger break in the correct location for exceptions thrown in Async methods in a Console App? -

javascript - React.js: onClick function from child to parent -