Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Desktop
User Name
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.


  Search this Thread
Old 01-03-2018, 03:29 PM   #1
Registered: Oct 2004
Distribution: Debian/Ubuntu, Arch, Gentoo, Void
Posts: 107

Rep: Reputation: 22
[SOLVED] Script won't run using key bindings (JWM centric)

This post will refer to a GNU/Linux desktop system running Arch and using the JWM window manager. I found a really nice little script at and am trying to implement it on my system. I installed missing dependencies, copied over the script to my system, then chmod'd it. Testing from the command line reveals that it works as intended. Here is what the script looks like:
xclip -o | trans -e google -b \
| tee >(yad --geometry=300x800+1550+100 --text-info  --wrap) >(xclip -i)
exit 0
However, to make the script operate optimally, I should invoke it using keystrokes. JWM is quite congenial to implementing custom key bindings and I've already set up more than one of these for running some simple little scripts I wrote for my system. Yet, when I try to implement keystrokes to run the script referenced above, I am unable to get it to work (nothing happens when I press the relevant keys). I've tried various permutations and have been over my .jwmrc file many times, but I cannot get it to work and am unable thus far to comprehend why I'm having these problems invoking the script using keystrokes.

In an attempt to do some troubleshooting, I redirected stderr to a file (my current key binding looks as follows:
<Key mask="4" key="t"> >>trans-paste_err.txt 2>&1</Key>
) The output written to that file, after having pressed the specified key combination, is
/path/to/ line 4: syntax error near unexpected token `('
/path/to/ line 4: `xclip -o | trans -e google -b | tee >(yad --geometry=300x800+1550+100 --text-info --wrap) >(xclip -i) exit 0'
Doing some searches on that error message led me to believe I should escape the parenthesis or quote them. I'm not real bash saavy, but my attempts at trying those sorts of things have not brought resolution. Of course I could well be doing something wrong.

So can anyone here provide any pointers on why I am seeing these results? Perhaps this is something peculiar to the way scripts are interpreted within JWM? Not sure where to turn for diagnosis of this issue, which has proved thus far to exceed my rather paltry technical acumen. TIA

Last edited by jamtat; 01-04-2018 at 09:54 AM.
Old 01-04-2018, 05:45 AM   #2
LQ Addict
Registered: Dec 2013
Posts: 8,745
Blog Entries: 5

Rep: Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141
i have tried the script, and it works.
if i change the first line from '#!/bin/bash' to '#!/bin/dash' i get a similar error:
/home/mus/bin/trans-paste: 6: /home/mus/bin/trans-paste: Syntax error: "(" unexpected
can you post output of
ls -l /bin/bash
bash --version
you might also want to try to tell jwm explicitely to use bash, like this:
bash -c
you can incorporate the logging into the script:
exec &gt; trans-paste_err.txt 2&gt;&amp;1
Old 01-04-2018, 08:32 AM   #3
Registered: Oct 2004
Distribution: Debian/Ubuntu, Arch, Gentoo, Void
Posts: 107

Original Poster
Rep: Reputation: 22
Thanks for your response, ondoho.
ls -l /bin/bash
-rwxr-xr-x 1 root root 828320 Feb 14  2017 /bin/bash
bash --version
GNU bash, version 4.4.12(1)-release (x86_64-unknown-linux-gnu)
I know I tried the bash -c option at some point--as in
<Key mask="4" key="t">exec:bash -c</Key>
but I should probably give it another shot; I've tried so many variations that it's hard to keep track of which and the results of each.

Actually, just now trying the above key binding entry I now have success--thanks for the suggestion! I guess I had previously incorporated the bash -c option into the script itself rather than within the key binding line.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Script When Any Key Pressed, Run 2nd Script After Any Pause jakfish Linux - General 2 08-25-2016 06:47 AM
JWM panel button using script Fixit7 Puppy 3 07-06-2014 01:43 PM
JWM bindings: how to use the WINDOWS FLAG key? frenchn00b Linux - Desktop 4 01-10-2010 08:35 AM
Any JWM experts here? Need advice/help with JWM linus72 Linux - Desktop 2 07-07-2009 04:41 PM
In KDE, how to run a sh script from the key bindings ? Xeratul Linux - General 3 12-17-2006 12:13 PM > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 03:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration