有没有办法在同一目录路径中的一个命令中处理两个文件?
Is there a way to two files in one command in the same directory path?
假设我正在做这样的事情:
touch app/api/api.rb && touch app/api/user/data.rb
有什么方法可以缩短这段时间,这样我就不必重复 touch app/api/
部分了吗?我尝试了 touch app/api/api.rb{/user/data.rb}
但它不起作用。
zsh
支持 brace expansion.
touch app/api/{api,user/data}.rb
使用子shell:
marc@panic:~$ (cd foo ; pwd); pwd
^-#1 ^-#2
/home/marc/foo <-#1
/home/marc <-#2
当subshell退出时subshell 'cd'将是lost/undone,而parent/controlling shell将是正确的是的。
假设我正在做这样的事情:
touch app/api/api.rb && touch app/api/user/data.rb
有什么方法可以缩短这段时间,这样我就不必重复 touch app/api/
部分了吗?我尝试了 touch app/api/api.rb{/user/data.rb}
但它不起作用。
zsh
支持 brace expansion.
touch app/api/{api,user/data}.rb
使用子shell:
marc@panic:~$ (cd foo ; pwd); pwd
^-#1 ^-#2
/home/marc/foo <-#1
/home/marc <-#2
当subshell退出时subshell 'cd'将是lost/undone,而parent/controlling shell将是正确的是的。