我有以下设置,我使用 OpenSSH 服务器远程启动某个命令ssh。
我的authorized_keys文件有以下条目:
command="/path/to/script.sh $SSH_ORIGINAL_COMMAND",no-port-forwarding,no-x11-forwarding,no-agent-forwarding ssh-rsa AAAA\xe2\x80\xa6qGDf my_special_key\nRun Code Online (Sandbox Code Playgroud)\n\n这意味着如果有人使用该密钥(例如通过使用ssh -i special_key_file user@server)连接,脚本script.sh将在我的服务器上执行。现在还有一个$SSH_ORIGINAL_COMMAND占位符,它被命令的所有额外命令行替换ssh,即ssh -i special_key_file user@server foobar意味着将在其中$1包含。foobar
为了测试它,我可以使我的script.sh外观如下:\n
#!/bin/sh\nprintf \'<%s>\\n\' "$@"\nRun Code Online (Sandbox Code Playgroud)\n\n现在ssh -i special_key_file user@server \'foo bar\'就像 forssh -i special_key_file user@server foo bar我会得到以下相同的结果:
<foo>\n<bar>\nRun Code Online (Sandbox Code Playgroud)\n\n因为分裂。如果这还不够糟糕的话,因为ssh -i special_key_file user@server \'*\'我得到了一个文件列表:
<file1>\n<file2>\n\xe2\x80\xa6\nRun Code Online (Sandbox Code Playgroud)\n\n因此,显然整个额外的命令行被插入到内部的内容中command=,然后在 shell 中运行,并发生所有拆分和全局步骤。显然我不能在零件 …
我在许多配置文件中看到过像下面这样的行(xmobar有其中之一,dmenu也有这个)
'-*-fixed-*-*-*-*-18-*-*-*-*-*-*-*'
Run Code Online (Sandbox Code Playgroud)
-)分隔的每个标记的含义是什么?还有另一种带有明显占位符的变体。我在哪里可以看到这个字体列表?(我知道xft字体是不同的)
xft:Bitstream Vera Sans Mono:size=10:antialias=true
Run Code Online (Sandbox Code Playgroud) 我正在使用一个工具(openocd)打印大量垃圾,然后一个基本进度条缓慢打印简单的点,然后再次打印一些垃圾。
我想过滤此输出,以便grep仅显示带有进度条的行,并且是实时的(即输出的每个点openocd立即打印在终端中):
openocd <args> |& grep '^\.'
Run Code Online (Sandbox Code Playgroud)
问题是grep(最多)是行缓冲的,因此进度条在完成之前不会显示。
我该如何处理grep,或者是否有任何标准替代方案可以实现此目的?如果有一种通过openocd配置的方法,这将很有用,尽管我更喜欢更通用的解决方案。
每个人都同意 Wayland 比 X11 更适合您常用的桌面。为什么每个主要发行版都使用 X?是错误,应用程序兼容性差(甚至是问题吗?)还是其他什么?
我想替换模式的每个奇数或偶数出现。看下面的例子:
$ echo aaaaa | sed -e 's/a/b/' -e 's/a/c/' -e 's/a/b/' -e 's/a/c/' -e 's/a/b/'
bcbcb
Run Code Online (Sandbox Code Playgroud)
有没有一些命令可以更简洁地做到这一点?我实际上正在做的是将*s转换为 BBCode[i]和[/i]标签,所以如果那里有降价到 BBCode 的转换器,我也想听听。
我有我想格式化的字符串。我想删除 second;和 second last之间的所有内容;。
输入
cellular organisms;Eukaryota;Opisthokonta;Metazoa;Eumetazoa;Bilateria;Protostomia;Ecdysozoa;Panarthropoda;Arthropoda;Mandibulata;Pancrustacea;Hexapoda;Insecta;Dicondylia;Pterygota;Neoptera;Endopterygota;Coleoptera;Polyphaga;Cucujiformia;Tenebrionoidea;Tenebrionidae;Tenebrionidae incertae sedis;Tribolium;Tribolium castaneum;
Run Code Online (Sandbox Code Playgroud)
输出
cellular organisms;Eukaryota;Tribolium castaneum;
Run Code Online (Sandbox Code Playgroud)
我试过使用 sed
sed 's/;[^;]*//' <<<"cellular organisms;Eukaryota;Opisthokonta;Metazoa;Eumetazoa;Bilateria;Protostomia;Ecdysozoa;Panarthropoda;Arthropoda;Mandibulata;Pancrustacea;Hexapoda;Insecta;Dicondylia;Pterygota;Neoptera;Endopterygota;Coleoptera;Polyphaga;Cucujiformia;Tenebrionoidea;Tenebrionidae;Tenebrionidae incertae sedis;Tribolium;Tribolium castaneum;"
Run Code Online (Sandbox Code Playgroud)
产生
cellular organisms;Opisthokonta;Metazoa;Eumetazoa;Bilateria;Protostomia;Ecdysozoa;Panarthropoda;Arthropoda;Mandibulata;Pancrustacea;Hexapoda;Insecta;Dicondylia;Pterygota;Neoptera;Endopterygota;Coleoptera;Polyphaga;Cucujiformia;Tenebrionoidea;Tenebrionidae;Tenebrionidae incertae sedis;Tribolium;Tribolium castaneum;
Run Code Online (Sandbox Code Playgroud) On a board, I would like to flash the (NAND) partition where my current rootfs is without restarting and being able to check if the flash succeeded.
To do so, I try to:
我正在尝试编译一个 C 程序,它告诉我
user@cu-cs-vm:~/Downloads/pa5$ make
gcc -c -g -Wall -Wextra `pkg-config fuse --cflags` fusehello.c
Package fuse was not found in the pkg-config search path.
Perhaps you should add the directory containing `fuse.pc'
to the PKG_CONFIG_PATH environment variable
No package 'fuse' found
fusehello.c:21:18: fatal error: fuse.h: No such file or directory
compilation terminated.
Run Code Online (Sandbox Code Playgroud)
当我尝试安装保险丝时,它只是告诉我它已经安装了。
sudo apt-get install fuse
Run Code Online (Sandbox Code Playgroud)
我看了看usr/lib/pkgconfig,并fuse.pc没有在那里。它应该在那里吗?
第一次测试btrfs,看看是否可以将其用于特定项目。
我在虚拟机中工作。
使用这 3 个大小随机的小型磁盘创建了一个卷。
mkfs.btrfs -d single /dev/sdb /dev/sdc /dev/sdd
mount /dev/sdb /mnt/data
Run Code Online (Sandbox Code Playgroud)添加另一个设备只是为了测试
btrfs device add /dev/sde /mnt/data
Run Code Online (Sandbox Code Playgroud)创建一堆 1GB 文件来填满磁盘
dd if=/dev/urandom of=1GB_07.bin bs=64M count=16 iflag=fullblock
Run Code Online (Sandbox Code Playgroud)我从虚拟机中删除了其中一个磁盘并重新启动
我能够以只读模式强制安装
mount -ro degraded /dev/sdb /mnt/data
Run Code Online (Sandbox Code Playgroud)我可以看到所有文件。我尝试将它们同步到另一个目录,但无法复制我创建的 1G 文件之一。有道理,它在丢失的磁盘上!
从这里开始,有没有一种方法可以“废弃”丢失的磁盘及其上的文件,并使事物再次以读/写模式运行?我只是想将一个盒子与一堆随机大小的磁盘拼凑在一起。冗余对我来说并不重要,而且我不希望在这个盒子上镜像数据的开销。
如果我丢失了包含一些数据的驱动器,我只想替换/删除它并从源重新同步以获取 BTRFS 计算机上丢失文件的新副本。
那有意义吗?这可能吗?
我正在使用 fmt (GNU coreutils) 8.25,但我不明白如何使用它。特别是,我不明白以下结果。
$ echo -n "a b c d e" | fmt -w3 -g3
我期望获得
a b
c d
e
Run Code Online (Sandbox Code Playgroud)
但我明白了
a
b
c
d
e
Run Code Online (Sandbox Code Playgroud)
所以我想可能会fmt计算它插入并尝试的换行符
$ echo -n "a b c d e" | fmt -w4 -g4
但是,我得到:
a
b c
d e
Run Code Online (Sandbox Code Playgroud)
最后,我没有得到以下内容:
$ echo -n "a b c d e" | fmt -w4 -g1
我希望给
a
b
c
d
e
Run Code Online (Sandbox Code Playgroud)
而是再次导致
a
b c
d e
Run Code Online (Sandbox Code Playgroud)所以,显然我无法理解-w和-g选项是如何工作的。 …