Permission Denied, RHEL, dot command in a key binding, gconf-editor
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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?
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.
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 -).
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.