LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-27-2013, 08:33 AM   #1
lanta
LQ Newbie
 
Registered: Feb 2009
Location: Toronto
Distribution: RHEL
Posts: 6

Rep: Reputation: 0
Permission Denied, RHEL, dot command in a key binding, gconf-editor


Trying to set up my F12 key to run a script named /foo/bar in a gnome-terminal (RHEL 5.9). Have typed /foo/bar in the value field of the keybinding_commands portion of apps->metacity using the gconf-editor and connected it to the F12 key in global_keybindings and it works well...except when I change /foo/bar to ". /foo/bar" (without the quotes; yes there's a space between the dot and the first slash). I want /foo/bar to run in the current shell because it makes changes to the environment.

When I try this, I get the following in a window:
There was an error running ". /foo/bar":
Failed to execute child process "." (Permission denied).
I find this odd because I can type those literal characters ". /foo/bar" in the terminal screen and it works properly.

I just want those literal characters to go to the gnome-terminal that has the input focus. What's happening behind the scenes to cause this behavior? Thanks.
 
Old 03-27-2013, 08:37 AM   #2
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,516

Rep: Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222
but metacity is not a bash and does not understand . as bash. It wanted to find an executable named ., but it is actually a directory and cannot be executed.
From the other hand . <command> will work only in the current shell, other apps and GUI will not be affected.
 
Old 03-27-2013, 08:42 AM   #3
lanta
LQ Newbie
 
Registered: Feb 2009
Location: Toronto
Distribution: RHEL
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pan64 View Post
but metacity is not a bash and does not understand . as bash. It wanted to find an executable named ., but it is actually a directory and cannot be executed.
From the other hand . <command> will work only in the current shell, other apps and GUI will not be affected.
I see. Thanks!

Would there be a different approach using gconf-editor to achieve my desired effect then, anyone?
 
Old 03-27-2013, 10:13 AM   #4
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,516

Rep: Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222
what kind of changes do you need?
 
Old 03-27-2013, 10:42 AM   #5
lanta
LQ Newbie
 
Registered: Feb 2009
Location: Toronto
Distribution: RHEL
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pan64 View Post
what kind of changes do you need?
The functionality I'm after is to be able to click in a running gnome-terminal window (to give it the input focus) and hit a key (such as F12) and have gnome/metacity/(something else?) place arbitrary characters in that window at the current cursor position so that I can subsequently hit the Enter key and have those characters executed as a command.

Using the date command as an example, if I'm logged into a bash shell within a gnome-terminal and I'm at the command prompt:
$ _
I'd like to be able to hit F12 and have the characters 'd' 'a' 't' 'e' placed at the cursor:
$ date_
at which point I'd just hit the Enter key to execute that command. (It would also be fine if I did not have to hit the Enter key and the command was executed immediately.)

The actual characters I'd be typing are not 'date' but a fairly long string that I find myself typing several times a day. The reason I'd like this tied to an F-key (rather than, for example, just creating an alias for it in .bashrc) is that I'm most often typing this string after 'su-ing' to another user with a hyphen (eg 'su -' or 'su - jdoe') and I don't want to muck with root's or jdoe's .bashrc files (or any of their files for that matter).

And indeed, as mentioned originally, the first two characters need to be a dot followed by a space so that the command is executed in the current shell, not a subshell.

RHEL 5.9
Gnome 2.16.0
Metacity 2.16.0
 
Old 03-27-2013, 11:54 AM   #6
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,516

Rep: Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222Reputation: 1222
I would suggest you to create aliases, and create a file for example <some dir>/.myaliases.
When you execute a su - <anyone> first you source your aliases (that is . <some dir>/.myaliases) and you will reach all your aliases
remember, the file in ~ is accessible only by the owner, so probably you need to find another place.
a more interesting solution can be to modify the common bashrc to use your aliases in case the current terminal (exists) and is owned by you (that will be owned by the creator and will not be changed after a su -).
 
Old 03-27-2013, 12:12 PM   #7
lanta
LQ Newbie
 
Registered: Feb 2009
Location: Toronto
Distribution: RHEL
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pan64 View Post
I would suggest you to create aliases, and create a file for example <some dir>/.myaliases.
When you execute a su - <anyone> first you source your aliases (that is . <some dir>/.myaliases) and you will reach all your aliases
remember, the file in ~ is accessible only by the owner, so probably you need to find another place.
a more interesting solution can be to modify the common bashrc to use your aliases in case the current terminal (exists) and is owned by you (that will be owned by the creator and will not be changed after a su -).
Thanks for the thoughtful bypass, pan64. That seems like a viable way to accomplish the specific task at hand.

However, I'll leave it open for possibly others to comment on a more general solution that would involve hitting just one key. Perhaps my overall approach (gconf-editor/metacity branch) is misguided.
 
  


Reply

Tags
gnome, keybinding, macros


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
[SOLVED] RHEL 4, /etc/sysconfig/iptables permission denied rfreiberger Linux - Newbie 4 04-07-2010 08:56 PM
error: permission denied on key 'dev.parport.parport0.autoprobe' abhayani Linux - Newbie 0 04-27-2009 01:15 AM
busybox command works, same command within script says permission denied jeroenv Linux - Newbie 2 01-17-2009 02:58 AM
NFS mounts not working in AIX 5.3 getting permission denied from RHEL sudheer_pn Linux - Newbie 2 10-06-2008 01:29 AM
get permission denied when trying to use info command. I nick623 Linux - Newbie 3 12-28-2004 06:06 PM


All times are GMT -5. The time now is 10:29 PM.

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