Il 19/12/20 14:18, David Haller ha scritto:
Hello,
On Sat, 19 Dec 2020, Marco Calistri wrote:
Il 19/12/20 12:42, David Haller ha scritto:
exec 1>>"$OSRF" Is not working here,
I want to use this syntax but it is returning error:
/etc/cron.hourly/sig-os-release: riga 7: EOF not expected during the search of """ /etc/cron.hourly/sig-os-release: riga 8: syntax error: EOF not expected You got a missing " somewhere. And mind you, you should not use printf as you use echo!
#!/bin/sh OSRF="/home/marco/.thunderbird/cy71896h.Marco/signatures/os-release.txt" OK.
#>>"$OSRF" That'd be appending, not "nulling" the output file, use >"$OSRF" (just one '>' in front of the filename (variable). Yes I knew about this to nulling files content the exec is present regularly but the exec 1 didn't worked here!
printf "Marco Calistri\n" >> "$OSRF" ok.
printf "Build:$(head -n 1 /etc/issue|awk -F'to' '{print $2}'|awk -F'-' '{print $1}')" >> "$OSRF" If you must:
printf 'Build: %s\n' \ "$(head -n 1 /etc/issue | awk -F'to' '{print $2}' | \ awk -F'-' '{print $1}')"
But see my version with rpm/parsing of os-release!
printf "Desktop:$(rpm -q --qf XFCE (%{version})\n -f /usr/bin/xfce4-session">>> "$OSRF" ^^^^^^^^^^^^^^^^^^^^^^ you're missing quotes here around the format argument for --qf for rpm! *BADUMM* *tssss*
Just use the script I proposed! I'm a kinda "mountain man" which obstinately insists on his errors! My updated script is this below, it works if I executed from my user shell, let's see what Mr. cron will do...
"$OSRF"
"$OSRF"
#!/bin/sh OSRF="/home/marco/.thunderbird/cy71896h.Marco/signatures/os-release.txt" printf "Marco Calistri\n" >> "$OSRF" printf "Build:$(head -n 1 /etc/issue|awk -F'to' '{print $2}'|awk -F'-' '{print $1}')\n" >> "$OSRF" printf "Kernel:$(uname -r)\n" >> "$OSRF" #printf "Desktop:$(rpm -q XFCE (%{version}) -f /usr/bin/xfce4-sessio)\n" printf "Desktop:$(xfce4-session --version |awk -F'xfce4-session' '{print $2}'|awk -F'2' '{print $2}')\n" >> "$OSRF" Cheers, -- Marco Calistri Build: openSUSE Tumbleweed 20201216 Kernel:5.9.14-1-default Desktop: (Xfce 4.14)