我知道可能没有简单的方法来做到这一点,但我想我可能会把它放在那里。我有一个目录,其中包含我处理的每个客户的子目录。我希望能够在计算机上的任何位置键入该客户目录名称,并切换到该目录。换句话说:自动添加别名到.bashrc
/dir/customers/
/dir/customers/customer1/
/dir/customers/customer2/
/dir/customers/customer3/
我想customer1表,customer2表,并customer3所有被添加到我的〜/ .bashrc文件,每当我创建一个新的客户,它会更新补充一点为好。
任何接受者?
谢谢你的快速响应。我不知道为什么我没有想到一个循环。我仍然在学习。非常感谢。 – DrewVS 2011-03-21 00:03:26
@DrewVS:*** NO!***没有必要使用'ls',事实上这是一个坏主意! Globbing会照顾它:'对于我in/dir/customers/*'。而且,'eval'是完全不必要的。 'alias $ i =“cd'/ dir/customers/$ i'”' – 2011-03-21 00:36:19
@Dennis Williamson:我同意你的建议,编辑剧本,非常感谢。 – anubhava 2011-03-21 00:41:31