bash script not working in conky [SOLVED]

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

bash script not working in conky [SOLVED]

Post by Logansfury »

Hello everyone,

I am working with the following bash script:

Code: Select all

logansfury@OptiPlex-5040:~$ xrandr_output=$(xrandr); resolutions=$(echo "$xrandr_output" | awk '/ connected/{print $1}' | while read -r monitor; do echo "$xrandr_output" | sed -n "/^$monitor/,/\*/p" | awk '/\*/{sub(/\*/,""); print $2 " Hz"}'; done); if [ -z "$resolutions" ]; then echo "No monitor detected"; else echo "$resolutions" | paste -sd ',' -; fi
59.95 Hz,59.95 Hz
In terminal, this displays 59.95 Hz, 59.95 Hz perfectly, but when I put it in a conky the display is blank:

Code: Select all

${color1}${goto 35}Refresh Rates: ${alignr}${color0}${exec xrandr_output=$(xrandr) && resolutions=$(echo "$xrandr_output" | awk '/ connected/{print $1}' | while read -r monitor; do echo "$xrandr_output" | sed -n "/^$monitor/,/\*/p" | awk '/\*/{sub(/\*/,""); print $2 " Hz"}'; done) && if [ -z "$resolutions" ]; then echo "No monitor detected"; else echo "$resolutions" | paste -sd ',' -; fi}
Can anyone please fix this to work?

Thank you for reading,

Logan
Last edited by Logansfury on Wed Apr 03, 2024 4:12 pm, edited 1 time in total.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: bash script not working in conky

Post by Koentje »

Logansfury wrote: Wed Mar 20, 2024 8:06 am Hello everyone,

I am working with the following bash script:
That's not a bash script, but a command line...
A bash script is a textfile with a load of commands. if statements, strings etc...
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: bash script not working in conky

Post by Logansfury »

Koentje wrote: Wed Mar 20, 2024 1:36 pm
Logansfury wrote: Wed Mar 20, 2024 8:06 am Hello everyone,

I am working with the following bash script:
That's not a bash script, but a command line...
A bash script is a textfile with a load of commands. if statements, strings etc...
My bad on the terminology. This one should be marked as solved though. I have scripts successfully showing refresh rate in my Display widget.

Just so I have this straight, Is the command line using bash language or is it a unique command line language?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: bash script not working in conky

Post by Koentje »

No it is probably using bash... but a script is a textfile with list of commands.
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: bash script not working in conky

Post by Logansfury »

Koentje wrote: Wed Mar 20, 2024 2:04 pm No it is probably using bash... but a script is a textfile with list of commands.
Gotcha! Thank you for you lesson :)
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
Post Reply

Return to “Compiz, Conky, Docks & Widgets”