Problem with script invoked from a keyboard shortcut
-EDIT-
I have solved my problem below by using a different program. Instead of xsel I am using xclip which basically does the same thing and works fine from a script invoked by a global hotkey.
-END EDIT-
Hi,
I've written a simple script to copy my email address into both the clipboard and the primary selection using a useful utility called xsel. This is so that I can assign a global shortcut key to the script to quickly paste my email address when needed.
When run from a terminal prompt, it works perfectly and I can paste the email address with <CTRL>V and by middle-clicking. However it does not work properly from the keyboard shortcut key - the script runs because the audio test sound plays, but my email address does not end up in the clipboard or in the primary selection.
If I use <Alt>F2 to bring up the Gnome 'Run Application' dialog box and enter the script's name the same thing happens (the audio test sound plays, but my email address does not end up in the clipboard or in the primary selection).
My guess as to what is happening is that there is a problem due to running the script in a shell instance which dies almost immediately.
I tried 3 ways around this, none fixed the problem:
1) I used the xsel option --keep in the xsel commands.
2) I got the xsel process Id using "$!" and then used "disown" on the process Id to disassociate the program from the shell instance it was running in. But I got "disown: : no such job" when run from the terminal command line - the job had finished before I could disown it.
3) I added "sleep 30" to the bottom of the script thinking that if I could get the shell instance to stay alive the email address might stay in the clipboard and in the primary selection.
None of these worked.
Any help sorting this out would be greatly appreciated. Many thanks.
PS. I will happily use another method of getting my email address into the clipboard or primary selection, I've used xsel because that was the only way I knew to do it.
Dear All,
I want to run a shell script with out logging to putty but configuring it to a keyboard short cut it windows PC. Can this be done? I want this to rename a log in a specified folder in a system
Thanks (8 Replies)
Hi, I've got a bit of a ridiculous problem and wasn't sure where to post it.
I need to use the vertical bar for piping in Bash but, as per the title, am using a UK layout on a US (physical) keyboard which doesn't have a key for it in the place I'd expect. I've tried using xbindkeys and Unicode... (7 Replies)
Hi All,
I have two scripts - ScriptA and ScriptB
ScriptA has logic to invoke ScriptB :
- with some parameter
- or without any parameter
ScriptB can also be invoked by the user from the command line.
Is there anyway to ensure that when I execute ScriptB from the command line, it does... (3 Replies)
Hi,
I have the following script -
fixpart="/files/myScript # Transfer Script"
echo "Specify the transfer frequency in minutes - "
echo "every 1, 2, 3, or 5 minutes (default every 1 minute) "
echo $nn "Frequency ? :" $cc
read ans
case $ans in
2) echo... (9 Replies)
Say there is a shell script named test.sh. I intentionally omit the #! line in test.sh for testing perpose. I did the following :
$ echo $0
-ksh ---> current shell
$ echo $$
12919 ---> PID of the current shell... (4 Replies)
Hi,
When I invoke a script s1.sh it will call an another script s2.sh by itself. This script s2.sh will call some java files, so while running the script it asks for a file name to be processed. Which we can see in the screen.
The file name to be processed is present in script s1.sh
Now I... (2 Replies)
Hi,
When I invoke a script s1.sh it will call an another script s2.sh by itself. This script s2.sh will call some java files, so while running the script it asks for a file name to be processed. Which we can see in the screen.
The file name to be processed is present in script s1.sh
Now... (1 Reply)