which-bugs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multiline aliases with --read-alias


From: Nevo Hed
Subject: Multiline aliases with --read-alias
Date: Tue, 25 Aug 2009 15:58:31 -0400
User-agent: RoundCube Webmail/0.2

Possible issue with '--read-alias'



# somewhere in .bashrc land .... a multiline alias (bash allows it)
alias alias1='rm -rf /tmp/x.em;
                  mv /tmp/.AgentSockets /tmp/x.em;
                  snmpdm -d -tcpany'


# If i use the following function to see where I get "mv" from
which1 ()
{
    ( alias;
    declare -f ) | /usr/bin/which --tty-only --read-alias --read-functions
--show-tilde --show-dot $@
}

# I get " mv /tmp/.AgentSockets /tmp/x.em;" from the above alias



# if I modify "which" to 
which2 ()
{
    ( alias | grep '^alias';
    declare -f ) | /usr/bin/which --tty-only --read-alias --read-functions
--show-tilde --show-dot $@
}

# it fixes the above problem but it now produces only a partial result for
"which2 alias1"



# Solution: if parsing an alias - dont assume a single line, alias body (in
# bash anyway) is bound with single quotes

# Thanks






reply via email to

[Prev in Thread] Current Thread [Next in Thread]