You are not logged in.

#1 2013-10-13 20:46:44

doggone
Member
Registered: 2013-06-19
Posts: 50

[SOLVED] Weirdness in bash

I'm writing this little dmenu script, but I'm having a problem with this part of the script. I'm clueless here.

This illustrates it:

#!/bin/bash
 
declare -A menu
 
menu[bc1]="urxvt -n /usr/share/icons/elementary/apps/64/accessories-calculator.svg -title bc -e sh -c 'bc'"
menu[bc2]="urxvt -n /usr/share/icons/elementary/apps/64/accessories-calculator.svg -title bc -e sh -c 'bc -iq'"
 
# works!
exec ${menu[bc1]}

# doesn't work.
exec ${menu[bc2]}

Last edited by doggone (2013-10-14 00:12:54)

Offline

#2 2013-10-13 21:09:56

mr.MikyMaus
Member
From: disabled
Registered: 2006-03-31
Posts: 285

Re: [SOLVED] Weirdness in bash

Try losing the single quotes. Also, the sh command seems redundant.

And next time, try to provide more information than just "doesn't work", oracles are expensive these days...


What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...

... and who is general Failure and why is he reading my harddisk?

Offline

#3 2013-10-13 23:18:22

doggone
Member
Registered: 2013-06-19
Posts: 50

Re: [SOLVED] Weirdness in bash

I get the same results without the "sh -c" and the quotes.

I would love to have some more information than "it doesn't work", but I'm not getting any myself. It just does nothing, no error message or anything.

Offline

#4 2013-10-13 23:21:26

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: [SOLVED] Weirdness in bash

Put set -x in your script.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2013-10-14 00:12:32

doggone
Member
Registered: 2013-06-19
Posts: 50

Re: [SOLVED] Weirdness in bash

cfr wrote:

Put set -x in your script.

Thanks. It was the quotes, but when I tried it the second time, I had the "exec ..." line commented out. So of course it wouldn't work!

Marking as solved.

Offline

Board footer

Powered by FluxBB