linux:使用别名正确输入错误?

时间:2016-05-05 23:44:32

标签: bash shell alias

当我在shell中工作并快速写入时,有时我会写“c d ..”而不是“cd ..”。有没有办法(比如bash-alias)用我奇怪的拼写执行“cd ..”? (我已经尝试在我的.bashrc中创建一个别名,但bash然后说

public void setSongsList(ArrayList<Song> songsList) {
    this.mSongList = songsList;
    Log.d("test fragment setSongsList", Integer.toString(mSongList.size()));
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    mInflater = inflater;
    mContext = container.getContext();
    mContainer = container;
    Log.d("test fragment onCreateView", Integer.toString(mSongList.size()));

    //check if ArrayList is empty
    if(mSongList == null || mSongList.isEmpty()){
        rootView = mInflater.inflate(R.layout.error_no_songs, mContainer, false);
    } else showListView();
    return rootView;
}

因为它只能使用单字别名,不是吗?)

谢谢你的快速帮助:D

1 个答案:

答案 0 :(得分:-1)

您可以将此添加到.bashrc:D

function c() {
    if [ "$1" = d.. ] ; then
        builtin cd ..
    fi
}