gpt4 book ai didi

linux - 一种在linux中用绝对路径替换快捷方式的方法

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:48:30 27 4
gpt4 key购买 nike

我有一个程序需要为特定文件提供绝对路径 - 将其命名为xfile 位于/home/user/.hidden/sub/sub2/xfile

有没有一种方法可以实现某种替换功能,我可以输入 xfile,然后按 TAB 并将其替换为绝对路径?

我已经尝试创建一个别名并将其导出到 ~/.profile 下,但程序到目前为止还不喜欢它。

最佳答案

如果您的 shell 是 bash,则将以下行添加到您的 ~/.bashrc

export xfile="/home/user/.hidden/sub/sub2/xfile";

注销,重新登录,调用即可使用:

your_program $xfile

唯一的区别是,您输入的不是 tab,而是 $

关于linux - 一种在linux中用绝对路径替换快捷方式的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34354151/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com