我使用 cron 作业offlineimap
每 2 分钟调用一次:
*/2 * * * * /usr/bin/offlineimap > ~/Maildir/offlineimap.log 2>&1
Run Code Online (Sandbox Code Playgroud)
我需要终止 cron 作业来解决问题。我怎样才能重新启动 cron 作业(无需重新启动)?我在网上找到了这个“解决方案”:
mylogin@myhost:~$ sudo /etc/init.d/cron restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service cron restart
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop cron ; start cron. The restart(8) utility is also available.
cron stop/waiting
cron …
Run Code Online (Sandbox Code Playgroud) 我有横向模式的 pdf 幻灯片,想创建一个新的 pdf 文件,其中包含幻灯片 4-up(再次处于横向模式),如下所示:
-----------------
| 1 | 2 |
-----------------
| 3 | 4 |
-----------------
Run Code Online (Sandbox Code Playgroud)
我知道有pdfjam
(可以像这样使用pdfjam --fitpaper true --nup 2x2 --delta '1mm 1mm' --scale 0.98 infile.pdf
),但它不保留超链接——gs
尽管如此。我想知道如何使用它gs
来完成任务(?)
或者,我主要使用 4-up 来打印幻灯片。我无法设法lpr
用于实现这一目标。如果有人对此有想法,这也会很有趣。
该CUPS文档并没有说如何指定页面范围,如“3至结束”。这可以在不知道文档页数的情况下完成吗?所以像lpr -o page-ranges=3-end -P myprinter
?
我有infile.tex
以下形式的文件(例如,)
AAAA
BBBB AAAA
CCCC BBBB AAAA
%%## Just some text
\begin{example}[foobar]
\begin{Sinput}
> set.seed(271)
> U <- runif(10)
> plot(U, 1-U)
\end{Sinput}
AAAA BBBB CCCC
\begin{Sinput}
> plot(qnorm(cbind(U, 1-U)))
\end{Sinput}
\end{example}
Run Code Online (Sandbox Code Playgroud)
我想提取所有以%%##
and开头的行以及\begin{Sinput}
and之间的所有行\end{Sinput}
,所以
%%## Just some text
\begin{Sinput}
> set.seed(271)
> U <- runif(10)
> plot(U, 1-U)
\end{Sinput}
\begin{Sinput}
> plot(qnorm(cbind(U, 1-U)))
\end{Sinput}
Run Code Online (Sandbox Code Playgroud)
我试图与sed
:
sed -n '/%%##\|\\begin{Sinput}/,/\\end{Sinput}/p' infile.tex
# 但也包含 \begin{example}[foobar]
sed -n '/^%%##\|\\begin{Sinput}/,/\\end{Sinput}/p' infile.tex
# 但不包含以开头的行 %%##
注意:上面的内容是从 …
我有以下(MWE)shell 脚本foo
:
#!/bin/bash
ARGS=("$@") # all arguments
## => if it exists, we need to drop the argument "-D" here
ls -l ${ARGS[@]} | sort -fk8
Run Code Online (Sandbox Code Playgroud)
如果foo
使用参数调用-D
(参数列表中的位置未知),如何-D
从参数列表中删除?unset ARGS[${#ARGS[@]}-1]
例如,我发现可以删除最后一个参数,但我不确定参数的传递顺序(所以我首先需要知道参数在哪个位置,然后在提供的情况下将其删除)。