Bash:第一个路径然后第二个作为同一命令中第一个路径的相对路径
Bash: the first path then the second as relative path to the first path in the same command
假设我想要:ln -s /very/long/path/to_file /very/long/path/from_file
有没有办法不再输入 from_file 的完整路径?
像:ln -s /very/long/path/to_file [sign]/from_file
其中 sign
自动显示为 /very/long/path
您是否知道 bash、zsh 或 fish 的一些方法?
当然可以,您可以像这样存储在变量中:
variable=/very/long/path
然后像这样使用它:
ln -s $variable/to_file $variable/from_file
嗯,如果用Bash,剪切(前面那个词,ctrl-w)粘贴(ctrl-y) 是你的朋友:
$ ln -s /very/long/path/
ctrl-w ctrl- yto_file
spacectrl-yfrom_file
如果路径中有space,需要ctrl-w more.
大括号展开!
ln -s /very/long/path/{to_file,from_file}
假设我想要:ln -s /very/long/path/to_file /very/long/path/from_file
有没有办法不再输入 from_file 的完整路径?
像:ln -s /very/long/path/to_file [sign]/from_file
其中 sign
自动显示为 /very/long/path
您是否知道 bash、zsh 或 fish 的一些方法?
当然可以,您可以像这样存储在变量中:
variable=/very/long/path
然后像这样使用它:
ln -s $variable/to_file $variable/from_file
嗯,如果用Bash,剪切(前面那个词,ctrl-w)粘贴(ctrl-y) 是你的朋友:
$ ln -s /very/long/path/
ctrl-w ctrl- yto_file
spacectrl-yfrom_file
如果路径中有space,需要ctrl-w more.
大括号展开!
ln -s /very/long/path/{to_file,from_file}