How to find out where alias (in the bash sense) is defined when running Terminal in Mac OS X

后端 未结 10 1144
时光取名叫无心
时光取名叫无心 2020-12-13 03:50

How can I find out where an alias is defined on my system? I am referring to the kind of alias that is used within a Terminal session launched from Mac OS X (10.6.3).

10条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-13 03:58

    I think that maybe this is similar to what ghostdog74 meant however their command didn't work for me.

    I would try something like this:

    for i in `find . -type f`; do   # find all files in/under current dir
    echo "========" 
    echo $i                         # print file name
    cat $i | grep "alias"           # find if it has alias and if it does print the line containing it
    done
    

    If you wanted to be really fancy you could even add an if [[ grep -c "alias" ]] then

提交回复
热议问题