You are not logged in.

#1 2016-05-21 22:37:35

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

awk » mawk or gawk

Just ran into a problem with a bash script running in conky.
Testing for another user that ran into this after a fresh BL RC install.

Changed the remind-cal.sh to use "mawk"

dates=$(remind -s /home/sector11/.reminders | mawk -F"[ /]+" '{if ( $3!=strftime( "%d" ) ) {DAYS=DAYS $3+0"|"}} END{sub("\\|$","",DAYS);printf DAYS}')
cal -h -B1A1 | mawk -v DAYS=${dates} '{

and sure enough:

  $ conky -c /media/5/Conky/S11_Rem_Cal.conky &
[3] 7353
[2]   Exit 1                  pkill -xf "conky -c /media/5/Conky/S11_Rem_Cal.conky"
 
 21 May 16 @ 19:06:17 ~
  $ Conky: forked to background, pid is 7362

Conky: desktop window (265) is root window
Conky: window type - normal
Conky: drawing to created window (0x2400002)
Conky: drawing to double buffer
mawk: line 2: function strftime never defined
mawk: line 24: function strftime never defined

Changed it to use "gawk" - BINGO!:

dates=$(remind -s /home/sector11/.reminders | gawk -F"[ /]+" '{if ( $3!=strftime( "%d" ) ) {DAYS=DAYS $3+0"|"}} END{sub("\\|$","",DAYS);printf DAYS}')
cal -h -B1A1 | gawk -v DAYS=${dates} '{

... and killed conky and fired it up again - the calendar comes back - no errors:

 21 May 16 @ 19:14:15 ~
  $ pkill -xf "conky -c /media/5/Conky/S11_Rem_Cal.conky" &
[1] 9028
Conky: received SIGINT or SIGTERM to terminate. bye!
[1]+  Done                    pkill -xf "conky -c /media/5/Conky/S11_Rem_Cal.conky"
 
 21 May 16 @ 19:14:21 ~
  $ conky -c /media/5/Conky/S11_Rem_Cal.conky &
[1] 9557
 
 21 May 16 @ 19:18:58 ~
  $ Conky: forked to background, pid is 9566

Conky: desktop window (265) is root window
Conky: window type - normal
Conky: drawing to created window (0x2400002)
Conky: drawing to double buffer

... try gawk after breakfast. smile


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#2 2016-05-22 02:55:16

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,652
Website

Re: awk » mawk or gawk

Mawk is the default version of awk in Debian because it's lighter and faster (so 'awk ...' will give you mawk). Most of the time it does the job OK...


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#3 2016-05-22 03:18:53

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: awk » mawk or gawk

Key words: most of the time.

'mawk' messed up in a bash script creating a calendar that highlights reminders from the reminder app, but gawk works fine.

So if awk/mawk doesn't work - gawk it.  smile


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#4 2016-05-22 04:00:37

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,652
Website

Re: awk » mawk or gawk

Sector11 wrote:

Key words: most of the time.

Indeed!
I remember having to install gawk for something too.

People who don't mind gawk's slight heaviness can edit their Debian alternative for awk to always point to gawk (or just uninstall mawk?).


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#5 2016-05-22 13:39:26

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: awk » mawk or gawk

Also: gawk is a dependency of inxi

Like you I installed gawk for something specific - not the conky thing though, that was a new one for me.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

Board footer

Powered by FluxBB