You are not logged in.

#1 2012-04-14 20:23:05

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

[SOLVED] Fork: not enough memory

Hey all,

I'm trying to get a pure bash statusbar in DWM. All is working fine except for the date function. Whenever I run that, I get an error:

fork: not enough memory

Indeed my RAM goes up like a rocket and obviously that's not what I want. Here's the snippet of my dwm_status script:

date(){
date="$(date "+%H:%M")"
echo -e "\x02É \x01$date"
}

....

# Pipe to status bar
while true ; do
  xsetroot -name "$(mpd) $(cpu) $(video) $(mem) $(disk) $(net) $(vol) $(bat) $(date)"
  sleep 1s
done &

I run the script through .xinitrc, with bash $HOME/.bin/dwm_status. I searched a bit on Google but this was more about servers and such. I'd like some Arch specific advice on this if possible, so hence my asking here. Looking forward to your reply, as I am sure this is not a hard issue to resolve!

Unia

Last edited by Unia (2012-04-14 21:18:53)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#2 2012-04-14 20:32:53

stlarch
Member
From: hell
Registered: 2010-12-25
Posts: 1,265

Re: [SOLVED] Fork: not enough memory

Try this and see if it still happens:

dte(){
dte="$(date +"%H:%M)"
echo -e "\x02É \x01$dte"
}

and change xsetroot -name "$(dte)"

Offline

#3 2012-04-14 20:49:05

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: [SOLVED] Fork: not enough memory

Hm, that seems to work. Though if I'm not mistaken (and Bash neither wink) you forgot an " in your function. Anyway, the only difference I see is the different name of the function and that in my function, the + is inside the quotes whereas in yours it's not.

What difference does that make?


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#4 2012-04-14 20:56:34

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] Fork: not enough memory

The difference is that calling the function something other than 'date' prevents an infinite loop.

Offline

#5 2012-04-14 20:58:35

stlarch
Member
From: hell
Registered: 2010-12-25
Posts: 1,265

Re: [SOLVED] Fork: not enough memory

Yeah what he said tongue

But yeah, you're right, I forgot the ", but you figured that much out.

Offline

#6 2012-04-14 21:18:40

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: [SOLVED] Fork: not enough memory

Ah oke I see. Thanks guys!


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

Board footer

Powered by FluxBB