运行自定义键盘和触摸板修改,我想使用以下命令激活 2 手指滚动:
xinput --set-prop id "Synaptics Two-Finger Scrolling" 1 1
Run Code Online (Sandbox Code Playgroud)
其中 id 是使用找到的设备 ID
xinput --list
Run Code Online (Sandbox Code Playgroud)
重启后谁改变的id。最好使用批处理脚本来自动查找 ID 并设置首选项。
<?php
$a='/\\\/';
$b='/\\\\/';
var_dump($a);//string '/\\/' (length=4)
var_dump($b);//string '/\\/' (length=4)
var_dump($a===$b);//boolean true
?>
Run Code Online (Sandbox Code Playgroud)
为什么PHP中带有3个反斜杠的字符串等于带有4个反斜杠的字符串?
我们可以在正则表达式中使用 3 个反斜杠版本吗?
PHP参考资料 说我们必须使用 4 个反斜杠。
注意:单引号和双引号 PHP 字符串具有反斜杠的特殊含义。因此 if\必须与正则表达式匹配\\,那么PHP 代码中必须使用"\\\\"or 。'\\\\'
我有一个P接受文件名作为参数的脚本:
P file1 file2 file3 ....
Run Code Online (Sandbox Code Playgroud)
我还有一个脚本G,它生成文件名(通常是短列表),每行一个文件名。在我想用zsh编写的主脚本中,我想用G它来生成要由P. 天真的尝试是这样的:
P $(G)
Run Code Online (Sandbox Code Playgroud)
这几乎很有效,只是我生活在一个恶意的人喜欢创建带有嵌入空间的文件的世界中。如果G会生成这样的文件列表:
one_file
a file with spaces
Run Code Online (Sandbox Code Playgroud)
P将被称为
P one_file a file with spaces
Run Code Online (Sandbox Code Playgroud)
代替
P 'one_file' 'a file with spaces'
Run Code Online (Sandbox Code Playgroud)
一个明显的解决方案是将G和粘合P在一起,不是通过命令替换,而是通过某种语言(Ruby、Perl、Python、Algol68,....)的小程序,该程序执行P并将参数传递给读取标准输入。
这编写起来很简单,甚至可以重用。然而,我想知道,zsh及其各种好东西是否没有内置的解决方案来解决这个问题?
我正在使用 mac 并且我有一个脚本文件print_hello:
#!/bin/bash
echo hello
Run Code Online (Sandbox Code Playgroud)
如果我直接从带有./print_hello命令和 zsh 终端的目录运行它,它将正确打印 hello。我想将其添加为全局命令,因此print_hello在终端中写入应该打印“你好”。但我得到的是:
zsh: command not found: print_hello
Run Code Online (Sandbox Code Playgroud)
路径是正确的(我在 中对其进行了编辑.zshrc)。该文件具有适当的权限(我使用过chmod 755 print_hello):
? ~ echo $PATH
/Users/mateusz/bin:/usr/local/bin:/Users/mateusz/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/GE/bin:~/scripts
Run Code Online (Sandbox Code Playgroud)
并且print_hello文件在~/scripts
我可以运行脚本的唯一方法是直接从它的目录中运行。我该怎么办?我添加了一些别名.zshrc并且它们正在工作,那么为什么可执行脚本不起作用?
我的文件中有这个别名.zshrc:
alias rmcons="docker rm -f $(docker ps -aq)"
Run Code Online (Sandbox Code Playgroud)
但在尝试执行它之后,它只删除一个容器,然后打印
$rmcons
ef8197f147fb
zsh: command not found: c2ea2673f9e4
zsh: command not found: 4603059f1618
zsh: command not found: 40ad60328595
Run Code Online (Sandbox Code Playgroud)
如何删除所有docker ps -aq显示的容器?