I have two commands that both work in terminal:
notify-send "$(more /home/tim/autest.sh | head -1)"
and
notify-send "$(cat /home/tim/autest.sh | head -1)"
putting them in a script like this:
#! /bin/bash
notify-send "$(more /home/tim/autest.sh | head -1)"
notify-send "$(cat /home/tim/autest.sh | head -1)"
still gives two outputs, but only one is the actual correct output:
More:
Cat:
When I run from the terminal, they both show the correct output. Why is this? Why does more not give the correct output when triggered from a keyboard shortcut?
Note that this is not an issue with notify-send
, it does the same thing when echoing to a log file:
#! /bin/bash
echo $(more /home/tim/autest.sh | head -1) > log1.txt
echo $(cat /home/tim/autest.sh | head -1) > log2.txt
Log1:
::::::::::::::
Log2:
#! /bin/bash
more
? (BTW, why not justhead -1 /home/tim/autest.sh
?)-1
parameter to more ? It's supposed to limit screen size to one line::::::::::::::
/home/tim/autest.sh
.