Reputation: 31
I am trying to write a script where I am executing
connmanctl services
it gives me:
A0 Wired ethernet_abcdefghijkl_cable
I want to extract ethernet_abcdefghijkl_cable
and put it in a variable.
How can I do that?
I tried following so far but didn't work:
x="$(connmanctl services)"
echo "$x" | cut -d' ' -f 3
Upvotes: 0
Views: 766
Reputation: 36
# store command output in an array
read -ra array < <(conmanctl services)
var=${array[2]}
no need to involve cut
Upvotes: 1