I have a strange behavior in my terminal.
The following command prints nothing to my terminal:
comment=$(
cat /usr/share/applications/brasero.desktop |
grep '^Comment=' |
grep -Po '(?<=^Comment=)[ --0-9A-Za-z/.]*'
)
echo $comment
Exactly the same command, same syntax works perfectly inside a bash script.
Usually, i see people complaining about the opposite behavior.
I know that above operation could be done by hundreds of ways, but i can not understand why above command is not operating in my terminal.
On the other hand these commands work ok in both terminal and script:
comment=$(
cat /usr/share/applications/brasero.desktop |
grep -Po '(?<=^Comment=)[ --0-9A-Za-z/.]*'
)
echo $comment
grep -Po '(?<=Exec=)[ --0-9A-Za-z/:space:]*' > /usr/share/applications/brasero.desktop
I use GNU bash, version 4.4.0(1)-release (x86_64-pc-linux-gnu), under Debian 8 Sid, with grep (GNU grep) 2.26. I have tried in both xfce and mate terminal but same behavior.
Thanks