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":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. |
Quote:
Would there be a different approach using gconf-editor to achieve my desired effect then, anyone? |
what kind of changes do you need?
|
Quote:
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 |
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 -). |
Quote:
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. |
All times are GMT -5. The time now is 04:30 PM. |