Discussion:
script no longer workin
(too old to reply)
pinnerite
2024-03-21 17:13:29 UTC
Permalink
This is a single active line that generates the signature at the foot
of this message or rather it used to.

awk -F= '/PRETTY/ {print $2}' /etc/os-release | sed "s/\"//g", uname -r
cinnamon --version > /signature_line.txt

Since moving to a new machine and updating to Mint 21.3 it now generates this:

ed (GNU sed) 4.8
Packaged by Debian
Copyright © 2020 Free Software Foundation, Inc.
Licence GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jay Fenlason, Tom Lord, Ken Pizzini,
Paolo Bonzini, Jim Meyering, and Assaf Gordon.

This sed program was built with SELinux support.
SELinux is disabled on this system.

GNU sed home page: <https://www.gnu.org/software/sed/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-***@gnu.org>.

What might have changed?

Alan
--
Linux Mint 21.3 kernel version 5.15.0-100-generic Cinnamon 6.0.4
AMD Phenom II x4 955 CPU 16Gb Dram 2TB Barracuda
Chris Elvidge
2024-03-21 18:02:25 UTC
Permalink
Post by pinnerite
This is a single active line that generates the signature at the foot
of this message or rather it used to.
awk -F= '/PRETTY/ {print $2}' /etc/os-release | sed "s/\"//g", uname -r
cinnamon --version > /signature_line.txt
ed (GNU sed) 4.8
Packaged by Debian
Copyright © 2020 Free Software Foundation, Inc.
Licence GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jay Fenlason, Tom Lord, Ken Pizzini,
Paolo Bonzini, Jim Meyering, and Assaf Gordon.
This sed program was built with SELinux support.
SELinux is disabled on this system.
GNU sed home page: <https://www.gnu.org/software/sed/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
What might have changed?
Alan
Comma should be semicolon?
Try tr -d '"' instead of sed?
--
Chris Elvidge, England
I WILL NOT SQUEAK CHALK
pinnerite
2024-03-21 19:11:29 UTC
Permalink
On Thu, 21 Mar 2024 18:02:25 +0000
Post by Chris Elvidge
Post by pinnerite
This is a single active line that generates the signature at the foot
of this message or rather it used to.
awk -F= '/PRETTY/ {print $2}' /etc/os-release | sed "s/\"//g", uname -r
cinnamon --version > /signature_line.txt
ed (GNU sed) 4.8
Packaged by Debian
Copyright © 2020 Free Software Foundation, Inc.
Licence GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jay Fenlason, Tom Lord, Ken Pizzini,
Paolo Bonzini, Jim Meyering, and Assaf Gordon.
This sed program was built with SELinux support.
SELinux is disabled on this system.
GNU sed home page: <https://www.gnu.org/software/sed/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
What might have changed?
Alan
Comma should be semicolon?
Try tr -d '"' instead of sed?
You may be right but I found a solution before i could try it.
In case anyone wants to try it. Here is the full script:

#! /bin/bash
#
mint=$(awk -F= '/PRETTY/ {print $2}' /etc/os-release | sed "s/\"//g" )
# echo $mint
ktext="kernel version"
mversion=$(uname -r)
# echo $ktext $mversion
cmn=$(cinnamon --version)
echo $mint $ktext $mversion $cmn$'\n'AMD Ryzen 7 7700, Radeon RX 6600, 32GB DDR5, 1TB SSD, 2TB Barracuda > /home/alan/.config/sylpheed/sylpheed_signature.txt

Thanks, Alan
--
Linux Mint 21.3 kernel version 5.15.0-101-generic Cinnamon 6.0.4
AMD Ryzen 7 7700, Radeon RX 6600, 32GB DDR5, 1TB SSD, 2TB Barracuda
Sump
2024-03-21 20:57:06 UTC
Permalink
Post by pinnerite
You may be right but I found a solution before i could try it.
#! /bin/bash
#
mint=$(awk -F= '/PRETTY/ {print $2}' /etc/os-release | sed "s/\"//g" )
# echo $mint
ktext="kernel version"
mversion=$(uname -r)
# echo $ktext $mversion
cmn=$(cinnamon --version)
echo $mint $ktext $mversion $cmn$'\n'AMD Ryzen 7 7700, Radeon RX 6600, 32GB DDR5, 1TB SSD, 2TB Barracuda > /home/alan/.config/sylpheed/sylpheed_signature.txt
Thanks, Alan
Under bash

***@mwp-desktop:~$ echo -e `awk -F= '/PRETTY/ {print $2}' /etc/os-release | sed 's/\"//g'` kernel version:`uname -r`\\n`xfce4-about --version`\\nAMD Ryzen 7 7700, Radeon RX 6600....>~/.config/t.txt
***@mwp-desktop:~$ echo ~/.config/t.txt
/home/mwp/.config/t.txt
***@mwp-desktop:~$ cat ~/.config/t.txt
Linux Mint 21.3 kernel version:5.15.0-101-generic
xfce4-about 4.18.2 (Xfce 4.18) Copyright (c) 2008-2023 The Xfce development team. All rights reserved. Please report bugs to <https://gitlab.xfce.org/xfce/libxfce4ui/-/issues>.
AMD Ryzen 7 7700, Radeon RX 6600....
***@mwp-desktop:~$

Tweak as required.

Seems xfce4-about is noisy!
--
Sump
Big Al
2024-03-21 21:08:32 UTC
Permalink
Post by Sump
Post by pinnerite
You may be right but I found a solution before i could try it.
#! /bin/bash
#
mint=$(awk -F= '/PRETTY/ {print $2}' /etc/os-release | sed "s/\"//g" )
# echo $mint
ktext="kernel version"
mversion=$(uname -r)
# echo $ktext $mversion
cmn=$(cinnamon --version)
echo $mint $ktext $mversion $cmn$'\n'AMD Ryzen 7 7700, Radeon RX 6600, 32GB DDR5, 1TB SSD, 2TB Barracuda > /home/alan/.config/sylpheed/sylpheed_signature.txt
Thanks, Alan
Under bash
/home/mwp/.config/t.txt
Linux Mint 21.3 kernel version:5.15.0-101-generic
xfce4-about 4.18.2 (Xfce 4.18) Copyright (c) 2008-2023 The Xfce development team. All rights reserved. Please report bugs to <https://gitlab.xfce.org/xfce/libxfce4ui/-/issues>.
AMD Ryzen 7 7700, Radeon RX 6600....
Tweak as required.
Seems xfce4-about is noisy!
cinnamon --version I guess would replace the xfce4-about. Nice. Yes, a bit wordy !!👀
--
Linux Mint 21.3 Cinnamon 6.0.4 Kernel 6.5.0-26-generic
Al
yossarian
2024-03-21 22:59:44 UTC
Permalink
Post by pinnerite
echo $mint $ktext $mversion $cmn$'\n'AMD Ryzen
This dollar after cmn is too much :)
--
Mint 21.2 Virginia, kernel 6.5.0-25-generic, Cinnamon 6.0.4
AMD Ryzen 7 5700G with Radeon Vega Graphics, 32GB of DRAM.
Big Al
2024-03-21 18:10:05 UTC
Permalink
Post by pinnerite
This is a single active line that generates the signature at the foot
of this message or rather it used to.
awk -F= '/PRETTY/ {print $2}' /etc/os-release | sed "s/\"//g", uname -r
cinnamon --version > /signature_line.txt
ed (GNU sed) 4.8
Packaged by Debian
Copyright © 2020 Free Software Foundation, Inc.
Licence GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jay Fenlason, Tom Lord, Ken Pizzini,
Paolo Bonzini, Jim Meyering, and Assaf Gordon.
This sed program was built with SELinux support.
SELinux is disabled on this system.
GNU sed home page: <https://www.gnu.org/software/sed/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
What might have changed?
Alan
First the "awk -F= 'PRETTY {print $2}' etc/os-release " does not output anything. Even changing to
/etc/os-release fails.
Thus the sed has no option but to dump a help and about text to the screen.

I use this:
#!/bin/bash
echo `awk -F= '/PRETTY/ {print $2}' /etc/os-release | sed "s/\"//g"`" "`cinnamon --version`"
Al" > /home/alan/.thunderbird/Signature.txt

to do my sig. I run it just once a new OS comes along.
Does your script have the #!/bin/bash on line one?
--
Linux Mint 21.3 Cinnamon 6.0.4
Al
Big Al
2024-03-21 18:19:05 UTC
Permalink
Post by pinnerite
This is a single active line that generates the signature at the foot
of this message or rather it used to.
awk -F= '/PRETTY/ {print $2}' /etc/os-release | sed "s/\"//g", uname -r
cinnamon --version  > /signature_line.txt
ed (GNU sed) 4.8
Packaged by Debian
Copyright © 2020 Free Software Foundation, Inc.
Licence GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jay Fenlason, Tom Lord, Ken Pizzini,
Paolo Bonzini, Jim Meyering, and Assaf Gordon.
This sed program was built with SELinux support.
SELinux is disabled on this system.
GNU sed home page: <https://www.gnu.org/software/sed/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
What might have changed?
Alan
First the "awk -F= 'PRETTY {print $2}' etc/os-release " does not output anything.  Even changing to
/etc/os-release fails.
Thus the sed has no option but to dump a help and about text to the screen.
#!/bin/bash
echo `awk -F= '/PRETTY/ {print $2}' /etc/os-release | sed "s/\"//g"`" "`cinnamon --version`"
Al" > /home/alan/.thunderbird/Signature.txt
to do my sig.  I run it just once a new OS comes along.
Does your script have the #!/bin/bash on line one?Interesting. I copied you text but when pasted into a shell, the /PRETTY/ has the /'s removed.
--
Linux Mint 21.3 Cinnamon 6.0.4
Al
Paul
2024-03-21 19:48:20 UTC
Permalink
Post by pinnerite
This is a single active line that generates the signature at the foot
of this message or rather it used to.
awk -F= '/PRETTY/ {print $2}' /etc/os-release | sed "s/\"//g", uname -r
cinnamon --version  > /signature_line.txt
ed (GNU sed) 4.8
Packaged by Debian
Copyright © 2020 Free Software Foundation, Inc.
Licence GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jay Fenlason, Tom Lord, Ken Pizzini,
Paolo Bonzini, Jim Meyering, and Assaf Gordon.
This sed program was built with SELinux support.
SELinux is disabled on this system.
GNU sed home page: <https://www.gnu.org/software/sed/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
What might have changed?
Alan
First the "awk -F= 'PRETTY {print $2}' etc/os-release " does not output anything.  Even changing to /etc/os-release fails.
Be aware that at least one editor, now has an "autocompletion" feature,
which completely destroys muscle memory, and is a giant fuckup. TURN THAT OFF.
That's how things like slashes and quotes are getting destroyed.

The command line version of field separator seems to work with these two formats.

awk -F=
awk -F"="

and in some cases, you need quotes so there's no mistake about
interpretation of potential backslash escaping.

The field separator could have been made into the double-quote character,
removing the double-quote which is not desired.

$ awk -F= '/PRETTY/ {print $2}' /etc/os-release

"Linux Mint 21.3"

$ awk -F"\"" '/PRETTY/ {print $2}' /etc/os-release

Linux Mint 21.3

Naturally, the thing relies on the specifics of the
format used today, so it's brittle towards changes.

*******

Inlining other bits and pieces, is a lot more ugly.

awk 'BEGIN { dummy = ("/usr/bin/uname -r" | getline) >0
str = sprintf(" Kernel version %s",$1)
dummy = ("/usr/bin/cinnamon --version" | getline) >0
str = str sprintf(" %s %s",$1,$2)
FS="\"" }
/PRETTY/ {print $2 str}' /etc/os-release

but at least that no longer uses SED.

If the program instead pulled the script inside a file, as in

$ awk -f some.awk /etc/os-release

then the field separator can be pulled inside the some.awk file.

BEGIN {
FS = "\""
}

I don't think it would eat F=" for example.

Paul
Paul
2024-03-21 19:23:25 UTC
Permalink
awk -F= '/PRETTY/ {print $2}' /etc/os-release | sed "s/\"//g", uname -r, cinnamon --version > signature_line.txt
Paste this into a terminal, to see the immediate output.

You can redirect this.

awk 'BEGIN { dummy = ("/usr/bin/uname -r" | getline) >0
str = sprintf(" Kernel version %s",$1)
dummy = ("/usr/bin/cinnamon --version" | getline) >0
str = str sprintf(" %s %s",$1,$2)
FS="\"" }
/PRETTY/ {print $2 str}' /etc/os-release

*******

Output should be:

Linux Mint 21.3 Kernel version 5.15.0-100-generic Cinnamon 6.0.4

That does not use SED.

Paul
Loading...