Ubuntu Pastebin

Paste from wafflejock at Tue, 6 Dec 2016 07:12:36 +0000

Download as text
1
2
3
4
5
6
7
8
9
shaun@laptop:~/scripts$ cat test.sh 
f="power status: off"
regex="power status: (\w+)"

if [[ $f =~ $regex ]]
then
    match="${BASH_REMATCH[1]}"
    echo "Found it was $match"
fi
Download as text