我想在同一个图中绘制y1和y2.
x <- seq(-2, 2, 0.05)
y1 <- pnorm(x)
y2 <- pnorm(x, 1, 1)
plot(x, y1, type = "l", col = "red")
plot(x, y2, type = "l", col = "green")
Run Code Online (Sandbox Code Playgroud)
但是,当我这样做的时候,它们并没有被绘制在同一个地块中.
在Matlab中可以做到hold on
,但有人知道如何在R中做到这一点吗?
我想echo
在cat /etc/passwd | grep "sysa"
不正确时执行命令.
我究竟做错了什么?
if ! [ $(cat /etc/passwd | grep "sysa") ]; then
echo "ERROR - The user sysa could not be looked up"
exit 2
fi
Run Code Online (Sandbox Code Playgroud) 有什么区别
if (defined $hash{$key}) { }
Run Code Online (Sandbox Code Playgroud)
和
if (exists $hash{$key}) { }
Run Code Online (Sandbox Code Playgroud)
我什么时候知道使用哪个?
我有一个看起来像这样的表格
<form action="receiver.pl" method="post">
<input name="signed" type="checkbox">
<input value="Save" type="submit">
</form>
Run Code Online (Sandbox Code Playgroud)
当我点击提交但仍然receiver.pl
执行时,我想留在同一页面上.
应该怎么做?
我想检查两个文件是否存在,但我得到了
test.sh: line 3: [: missing `]'
Run Code Online (Sandbox Code Playgroud)
任何人都可以看到什么是错的?
#!/bin/sh
if [ -f .ssh/id_rsa && -f .ssh/id_rsa.pub ]; then
echo "both exist"
else
echo "one or more is missing"
fi
Run Code Online (Sandbox Code Playgroud) 我想制作一个SVN类型的补丁文件,httpd.conf
以便我可以轻松地将其应用到其他主机.
如果我做
cd /root
diff -Naur /etc/httpd/conf/httpd.conf_original /etc/httpd/conf/httpd.conf > httpd.patch
cp /etc/httpd/conf/httpd.conf_original /etc/httpd/conf/httpd.conf
patch < httpd.patch
Run Code Online (Sandbox Code Playgroud)
我明白了:
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|--- /etc/httpd/conf/httpd.conf_original 2012-04-26 13:36:08.331068438 +0200
|+++ /etc/httpd/conf/httpd.conf 2012-04-26 14:27:36.857075085 +0200
--------------------------
File to patch:
Run Code Online (Sandbox Code Playgroud)
题
我究竟做错了什么?
有人可以解释为什么我从下面得到退出代码141?
#!/usr/bin/bash
set -o pipefail
zfs list | grep tank
echo a ${PIPESTATUS[@]}
zfs list | grep -q tank
echo b ${PIPESTATUS[@]}
cat /etc/passwd | grep -q root
echo c ${PIPESTATUS[@]}
Run Code Online (Sandbox Code Playgroud)
我明白了
...
a 0 0
b 141 0
c 0 0
Run Code Online (Sandbox Code Playgroud)
从我的理解退出代码141失败,但上面的行给出零,所以它应该是成功,我会说.
我记得大约一年前我做了一些合并,导致提交消息Merge branch 'Name_of_branch'
在远程存储库上.
根据我的记忆,如果我重新定位分支中的所有提交然后将其合并到master然后推送到远程存储库,就会发生这种情况.
但现在我无法用git-1.7.2.2重现它.
它被修复了吗?或者有人可以解释这是如何发生的,也许是如何避免它?
如果我有哈希
my %h = (
secret => 1;
);
Run Code Online (Sandbox Code Playgroud)
我知道这只是哈希中的一个键,但我不知道它叫什么.
然后我必须遍历该哈希
my $key;
foreach my $i (keys %h) {
$key = $h{$i};
}
Run Code Online (Sandbox Code Playgroud)
或者有更好的方法来获取密钥的名称?
我有这个代码
foreach my $key (keys %ad_grp) {
# Do something
}
Run Code Online (Sandbox Code Playgroud)
哪个有效.
如果我没有%ad_grp
,但是参考$ad_grp_ref
,那么对于哈希来说会是什么样子?