Reputation: 121
I want to parse out current folder color for papirus folders theme. I have the following string:
List of available colors: black blue bluegrey brown cyan deeporange green grey > indigo magenta nordic orange pink red teal violet white yellow
I have no experience with regex. I want to color after the >
i.e. indigo
. The color can vary.
Can anyone please help me with the regex.
Upvotes: 0
Views: 56
Reputation: 241868
You don't need a regex, a parameter expansion can do that just fine:
#!/bin/bash
string='List of available colors: black blue bluegrey brown cyan deeporange green grey > indigo magenta nordic orange pink red teal violet white yellow'
color=${string#*> } # Remove everything up to "> ".
echo ${color%% *} # Remove everything after the first space.
Upvotes: 1