此别名搜索文件夹并打印出该文件夹的位置。
findme 1234567 --> Searching and printing
/xxx_data/xxe/TK/1234567/ --> This is the output of above alias.
alias findme='program -x SR $1' --> This is the alias.
有没有办法重新定义这个别名,当我运行 findme 1231412 时,它会直接将用户输入传递到 cd 并进入子文件夹。
示例
findme 1234567
/xxx_data/xxe/TK/1234567 <-- From here I do cd /xxx_data/xxe/TK/1234567/Allfiles
Find me 搜索并打印了文件夹位置,但我希望此别名实际上cd 到找到的文件夹的子文件夹(所有文件)中。
像这样
/xxx_data/xxe/TK/1234567/Allfiles <-- so how can I define an alias that can read user input findme and pass it to cd command
在此文件结构中,唯一变化的是数字/xxx_data/xxe/TK//Allfiles
最佳答案
别名不带参数。使用函数
findme () {
cd "$(program -x SR "$1")"
}
关于linux - 如何使用 linux 别名 cd 进入文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40043802/