views:

116

answers:

1

A simple example:

Let's say I have one alias being sourced somewhere as:

alias ls 'ls -o'

I'd like to have a second alias add on to this:

alias ls 'ls -a'

So that when I execute it, I'm really getting:

ls -o -a

Is this possible? Of course in the above example, the second overwrites the first.

Why would I want this? The first alias (much more complicated than the example) is publicly shared from the company server, and I'd prefer not duplicate it in case the original is modified.

I'm using C shell.

+1  A: 
eval "$(alias -p|grep '^alias ls='|sed "s/'$/ -o'/")"

Note that this assumes you're using bash.

bdonlan