用于少数命令的Bash脚本

用于少数命令的Bash脚本,bash,svn,Bash,Svn,现在我们有了一个命令which_repo address/to/file.js,它检测文件使用了什么svnrepo,并在屏幕上显示答案。它看起来像: myrepo/address/to/file.js 然后我应该键入svn/myrepo/address/to/file。我从中复制的字符串的末尾,该字符串返回答案 如何编写在步骤中执行此操作的函数,如: blame address/to/file.js 创建脚本责怪: #!/bin/bash svn blame "cvs/$(which_rep

现在我们有了一个命令
which_repo address/to/file.js
,它检测文件使用了什么
svn
repo,并在屏幕上显示答案。它看起来像:

myrepo/address/to/file.js
然后我应该键入
svn/myrepo/address/to/file
。我从
中复制的字符串的末尾,该字符串返回
答案

如何编写在步骤中执行此操作的函数,如:

blame address/to/file.js

创建脚本
责怪

#!/bin/bash
svn blame "cvs/$(which_repo "$1")"

创建脚本
责怪

#!/bin/bash
svn blame "cvs/$(which_repo "$1")"

编辑:避免反勾号和添加缺少的内部引号。谢谢@Aarondigula-我首先提交的内容相当草率。:-)编辑:避免反勾号和添加缺少的内部引号。谢谢@Aarondigula-我首先提交的内容相当草率。:-)