我正在编写一个脚本,通过SSH登录到远程服务器并执行一些命令,其中一个命令通过SSH登录到第二个远程服务器(我无法在本地访问)并执行命令。在嵌套的SSH命令之后,我的原始SSH命令终止并且不完成剩余的heredoc。我已经简化了一些脚本,但是得到了相同的结果:
one server1
two server2
我的输出如下:
three server1
我希望在输出结束时看到public static class Car {
public final static String NAME = "Car";
public static String getName() { return NAME; }
}
public static class SportsCar extends Car {
public final static String NAME = "SportsCar";
public static String getName() { return NAME; }
}
public static void main(String[] args) {
Car c0 = new Car();
System.out.println(c0.NAME);
System.out.println(c0.getName());
// both print "Car"
SportsCar c1 = new SportsCar();
System.out.println(c1.NAME);
System.out.println(c1.getName());
// both print "SportsCar"
Car c2 = new SportsCar();
System.out.println(c2.NAME);
System.out.println(c2.getName());
// both print "Car" because c2 ""doesn't know"" that it's really a 'SportsCar'
// this is an issue with your need for polymorphism with these values
}
,但它不会发生。我能够将这些命令分成两个SSH命令并得到我需要的东西,但我很好奇为什么会这样,并且有可能在一次拍摄中得到我期望的结果吗?
答案 0 :(得分:1)
替换
//make sure in fillable
protected $fillable = [
'status',
];
// ...
// In your model
public function close()
{
$this->update([
$this->status = 'close';
]);
}
与
ssh server2
防止从标准输入读取ssh。