Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

BASH Internal : Replace pattern with string without external command

$
0
0
Morning,
I'm trying step up my scripting game .. :rolleyes::confused::D

Is there a way to do the replacement with an or without using an external command ?

I did try but no joy.

Code:

var=${var//\(|\)/}


Code:

#!/bin/bash
var="lulus.UbiRwidgets.com (10.1.1.1)"
var=${var//\(/}
var=${var//\)/}
echo "$var"

Thanks !!
Have a great day !!
Pop

Viewing all articles
Browse latest Browse all 16232

Trending Articles