简体   繁体   中英

Linux: Possible to extend and Alias?

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.

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

请注意,这假设您正在使用bash。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM