一个平凡的冲突的包foo的,可向工作与酒吧,通过运行dpkg --force-conflicts -i foo。但最终是时候升级了,'apt-get' 对象:
% apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
foo : Conflicts: bar but 0.2-1 is installed
E: Unmet dependencies. Try using -f.
Run Code Online (Sandbox Code Playgroud)
可以调整/强制apt-get来容忍(几乎固定的)冲突,然后升级吗?
(快速存在证明:卸载foo,然后升级,然后像以前一样重新安装foo。因此有可能,问题是找到最不麻烦的机制。)
一个例子,但这个问题不是关于任何两个特定的包。
几年来,GNU parallel与moretutils发生了微不足道的冲突;每个都提供/usr/bin/parallel。 …
我知道ionice当您有多个进程请求访问相同的磁盘资源时如何帮助您,但是当您有多个磁盘时它如何工作?
例如,您有一个rsync操作从Drive A -> Drive Brsync移动数据,另一个操作从Drive C -> Drive D移动数据。
从理论上讲,由于它们不竞争资源,因此ionice这些rsync进程之一不应改变其吞吐量。这是它的工作方式,还是会影响性能?
此外,在独立于驱动器速度的linux系统上可能遇到的总I/O是否有一些“上限” ?就像连接 100 个SSD驱动器一样,在某些时候,操作系统会遇到驱动器速度之外的瓶颈吗?
Linux:ubuntu 14.04.3 LTS
cat /tmp/passfile
ABCxyz123
Run Code Online (Sandbox Code Playgroud)
sshpass -f /tmp/passfile parallel-ssh -I -A -h hostlist.txt "sudo -S ls -l /root" < /tmp/passfile
并且该方法在谷歌讨论此处描述groups.google 输出误差为:
[1] 01:07:25 [FAILURE] 10.0.4.194 Exited with error code 255
[2] 01:07:25 [FAILURE] 10.0.4.205 Exited with error code 255
Run Code Online (Sandbox Code Playgroud)
在远程服务器中,我试图连接它的 /var/log/auth.log 有以下消息
Sep 24 19:20:52 ubu1401 sshd[5765]: Accepted password for ubuntu from 10.0.4.1 port 55019 ssh2
Sep 24 19:20:52 ubu1401 sshd[5765]: pam_unix(sshd:session): session opened for user ubuntu by (uid=0)
Sep 24 19:21:26 ubu1401 sshd[5765]: pam_unix(sshd:session): session closed …Run Code Online (Sandbox Code Playgroud) 我rsync作为cron作业运行并通过conky(即“上次备份 2017 05 12 14:22:20”)显示上次备份。我想将上次备份显示为"2 days ago"或"4 hours ago",而不仅仅是显示静态日期戳。
有没有办法使用这种用户友好的输出格式来显示日期/时间?我看过man date,但找不到任何关于以这种格式输出日期的信息。我看到如何使用-d标志查询相对时间或日期,但看不到如何获取日期的输出以包含诸如"yesterday"、"3 days ago" 等词。
谢谢!
(此问题以 Maccaffeinate工具为例,但该概念适用于所有xargs接受实用程序作为参数的工具(即)。)
Mac 的caffeinate工具接受实用程序的名称:caffeinate sleep 1例如,(sleep实用程序在哪里)。有没有办法让它也接受一个zsh函数,而无需修改工具本身?例如:
function mysleep {
sleep 2
}
caffeinate mysleep # mysleep: No such file or directory
Run Code Online (Sandbox Code Playgroud)
编辑:这个问题确实是 Bash 的重复问题——感谢你指出我的答案。但是,对于 zshexport -f不起作用。有没有办法在 zsh 中做到这一点?(我正在删除bash标签以减少混淆。)
鉴于此输入:
# Lines starting with # stay the same
# Empty lines stay the same
# only lines with comments should change
ls # show all major directories
# and other things
cd # The cd command - change directory
# will allow the user to change between file directories
touch # The touch command, the make file command
# allows users to make files using the Linux CLI # example, cd ~
bar foo baz # foo foo foo …Run Code Online (Sandbox Code Playgroud) 假设我有以下 CSV:
\n\n$ cat test.csv\nid,domain\n1,foo.com\n2,bar.com\nRun Code Online (Sandbox Code Playgroud)\n\n使用mlr put,我可以轻松地将任何函数映射到 CSV 中的字段,只要我可以在 Miller DSL中定义它。因此,例如,mlr --csv put \'$id = $id + 1\'将增加id1。
但是,如果我可以 \xe2\x80\x99t 在 Miller\xe2\x80\x99s DSL 中定义该函数(也许是因为它不是纯函数)怎么办?假设我想将 CSV 中的每个域映射到一个 IP 地址。我\xe2\x80\x99d 喜欢做类似的事情mlr --csv put \'$ip = shell("nslookup $domain")。是否有捷径可寻?
目前,我正在将输入字段提取到一个单独的文件中,在单独的 shell 脚本中重写它,然后将结果添加回mlr join. 然而,这相当混乱,因为我的 CSV 充满了引号逗号和换行符,我需要自己小心处理,而不是依赖 Miller。
该/usr/bin/printfUTIL参数列表的长度被限制在外壳的最大命令行长度(即 getconf ARG_MAX,我的系统上会是2097152); 例子:
# try using a list that's way too long
/usr/bin/printf '%s\n' $(seq $(( $(getconf ARG_MAX) * 2 ))) | tail -1
Run Code Online (Sandbox Code Playgroud)
输出:
bash: /usr/bin/printf: Argument list too long
Run Code Online (Sandbox Code Playgroud)
今天我被告知shell内置 printf没有这个限制;测试:
printf '%s\n' $(seq $(( $(getconf ARG_MAX) * 2 ))) | tail -1
Run Code Online (Sandbox Code Playgroud)
输出:
4194304
Run Code Online (Sandbox Code Playgroud)
问题:
略读man bash dash一下似乎并没有说明builtin 的 这种优势printf。凡被它记录?
难道内置 printfS(例如 bash)在字符的参数列表最大长度,如果是这样,那是什么长度?
我有以下脚本从基于我的系统上的EXIF命令中提取数据busybox ash。我从文件末尾解析日期标签,并case用作最终检查以确保格式正确。我的问题是最后的if语句似乎总是返回 true;即 d="$e - Jebby (exif"总是运行。如果 Iecho $en并且echo $dn它显示$en大于$dn但该if语句仍然运行d="$e - Jebby (exif".
x=<valid filename>
e=$(exif -d -m -t 0x9003 -- "$x" 2>/dev/null)
let l=${#e}-18
e=$(expr substr "$e" $l 19)
e="${e%[ ][0-2][0-9][:][0-6][0-9][:][0-6][0-9]*}"
e="${e##*[!1-2][!09][!0-9][!0-9][!:][!0-1][!0-9][!:][!0-3][!0-9]}"
e=$(expr substr "$e" 1 4)$(expr substr "$e" 6 2)$(expr substr "$e" 9 2)
case "$e" in
[1-2][09][0-9][0-9][0-1][0-9][0-3][0-9])
let en=$e+3
ds="${d% - Jebby (}" …Run Code Online (Sandbox Code Playgroud) 如何显示每个已安装的命令行shell(即bash,zsh,等等),没有重复,没有别的,(即没有程序,没有弹)?此代码几乎适用我的Lubuntu系统,(有dash,ksh,zsh,csh和yash),但打印whiptail和无法打印yash:
apropos shell | grep sh | \
sed 's/ .*//;s/.*/which &/e;/^\/bin\//!d;s/.*/realpath &/e;/^\/bin\//!d' | \
sort -u | xargs whatis
bash (1) - GNU Bourne-Again SHell
bsd-csh (1) - a shell (command interpreter) with C-like syntax
dash (1) - command interpreter (shell)
ksh93 (1) - KornShell, a command and programming language
lksh (1) - Legacy Korn …Run Code Online (Sandbox Code Playgroud)