[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Edlug Archive Mar 2004
Re: [edlug] Trouble With Scripts
I've downloaded KeyChain - in the process of Fiddling.
What I was trying to do was to create a table of aliases/functions which
could serve as transparent links to the bits that are executed - but so
that they could be used in gnome menus, app launchers, as well as in
For example I would set up an alias 'ste' (for simple text editor) to be
associated with 'gedit &'
alias ste='gedit &'
But if I do this with aliases/functions - even if I set the launcher to
'run in script' it doesn't work.
I wanted to keep away from having a directory full of scripts or
symlinks, because they can't as easily be redirected as
aliases/functions can. This would make admin of user's
permissions/access to programs easier and would mean that some of the
path could be trimmed of.
Is there a solution out there already or is that what KeyChain is for?
thanks to everyone for their replies.
PS got O'reilly's PC Hardware In A Nutshell (picture of a scallop) &
reading through this. Head's buzzin'.
On Fri, 2004-03-12 at 18:44, Andrew Aylett wrote:
> Keith W Wyse <email@example.com> writes:
> > I wonder if anyone can answer this question;
> > I've been trying to create a script which will alias a word with a
> > command with the simple line
> > #!/bin/bash -v
> > alias someword='/somepath/somecommand &'
> > Unfortunately when I list the aliases in the gnome-terminal window after
> > having run the script, the alias does not exist.
> You need to inset the alias in to the current shell, while the script is
> running in a new (sub)shell. Ways around this:
> 1) Source the script in to the current shell using ". script". The only
> way (AFAIK) you can pass in parameters is as shell variables,
> 2) Add the aliases to your .bashrc, so they get added to every shell you
> 3) Make your script fire up a new shell and add the aliases to it. This
> is a bit messy -- it means that you're working in a shell inside your
> shell, to however many levels you run the script, and to log out you'll
> need to exit out through all the shells.
> If you can, I recommend option (2). You can have a look at KeyChain as
> an example of how this problem can be annoying... Unfortunately it's a
> pretty basic thing (and it can be very useful sometimes).
> Andrew Aylett | www.aylett.co.uk | 1.79 x 10^12 furlongs per fortnight...
> firstname.lastname@example.org | answer==42 | -- it's not just a good idea, it's the law!
You can find the EdLUG mailing list FAQ list at: