我有一个java程序,我希望能够在我的机器上的任何地方运行.我想从我的Cygwin命令提示符运行它.我已经制作了脚本来调用java程序.我将java程序的位置添加到类路径中,当我从java程序的目录运行它们时脚本工作.但是,当我尝试从任何其他目录运行时,我得到:
java.lang.NoClassDefFoundError: commandprogram/CommandProgram
Run Code Online (Sandbox Code Playgroud)
这是我的脚本:
#!/bin/sh
CWD=`dirname "$0"`
java -cp "$CWD/classes;$CWD/lib/AJarFile.jar" commandprogram/CommandProgram
Run Code Online (Sandbox Code Playgroud)
将java行更改为以下内容:
java -cp "$CWD/classes;$CWD/classes/commandprogram;$CWD/lib/AJarFile.jar" CommandProgram
Run Code Online (Sandbox Code Playgroud)
产生相同的结果.
我想做的是如下:
#!/bin/sh
EMAIL="-e 's/SOMETHING//g'"
somecommand | sed "$EMAIL"
Run Code Online (Sandbox Code Playgroud)
但我得到以下内容:
sed: -e expression #1, char 2: unknown command: `''
Run Code Online (Sandbox Code Playgroud)
我尝试了很多变化.我知道这只是让字符串引用正确的问题.我想这样做的原因是打破长sed命令以提高可读性.我应该只使用sed脚本文件(使用-f选项)吗?
更新:
我的实际脚本有点复杂:
#!/bin/sh
EMAIL="-e s/SOME THING//g -e s/SOME THING ELSE//g ..."
somecommand | sed "$EMAIL"
Run Code Online (Sandbox Code Playgroud)
删除单引号后,我得到:
sed: -e expression #1, char 18: unknown option to `s'
Run Code Online (Sandbox Code Playgroud) 在我的环境中,我们有Dev,Main和Production分支.我们还有业务和架构团队.我想要实现的目标如下:
目前,两个团队都是团队项目的贡献者组成员.
最终解决方案
注意:您不能拒绝贡献者的不需要的权限,因为如果用户同时在贡献者和促销官中,则拒绝优先,他们将没有正确的权限.其次,我无法实现仅允许合并到Main和Production的目标,因为您需要签入和签出权限以进行合并.
我尝试从我的集合中检索具有唯一ID的文档.
我有一个字段集合:名称,年龄,城市和等级.我想使用golang从mongodb获得'city'结果.
我的结构代码
type exp struct {
name string `bson:"name"`
age int `bson:"age"`
city string `bson:"city"`
rank int `bson:"rank"`
}
Run Code Online (Sandbox Code Playgroud)
使用以下代码从mongodb检索结果:
var result []exp //my struct type
err = coll.Find(bson.M{"City":bson.M{}}).Distinct("City",&result)
fmt.Println(result)
Run Code Online (Sandbox Code Playgroud)
使用此代码,我得到一个空数组作为结果.我怎么能到达所有城市?
鉴于:
$settings = @{"Env1" = "VarValue1"; "Env2" = "VarValue2" }
Write-Output "Count: $($settings.Values.Count)"
Write-Output "Value 0: '$($settings.Values[0])'"
Write-Output "Value 1: '$($settings.Values[1])'"
Run Code Online (Sandbox Code Playgroud)
我得到输出:
Count: 2
Value 0 : 'VarValue2 VarValue1'
Value 1 : ''
Run Code Online (Sandbox Code Playgroud)
为什么第一个元素有两个值而第二个元素没有?如何将值作为我可以索引的集合?