当我在普通终端上打开 zsh 时,我没有错误,而当我在 vscode 上打开它时,我得到:
z4h: core parameters have unexpectedly changed
Expected:
ZDOTDIR=/Users/*******
Found:
ZDOTDIR=/var/folders/0f/**************/T/vscode-zsh
Restore the parameters or restart Zsh with exec zsh.
Restore the parameters or restart Zsh with exec zsh.
Run Code Online (Sandbox Code Playgroud)
我用 z4h 安装了 zsh,并且运行了一段时间,效果很好。然后它开始随机显示此错误。
PS:我尝试使用 exec zsh 重新启动 Zsh。
编辑: 尝试创建文件夹“/var/folders/0f/***** /T/vscode-zsh”并按照建议将文件粘贴到 /Users/ 中,但它仍然不起作用。然后在该文件夹中的 .zshrc 中,我尝试从中编辑其中的一部分
if [[ "$VSCODE_INJECTION" == "1" ]]; then
if [[ $options[norcs] = off && -f $USER_ZDOTDIR/.zshrc ]]; then
VSCODE_ZDOTDIR=$ZDOTDIR
ZDOTDIR=$USER_ZDOTDIR
. $USER_ZDOTDIR/.zshrc
ZDOTDIR=$VSCODE_ZDOTDIR
fi
if [[ -f $USER_ZDOTDIR/.zsh_history ]]; then
HISTFILE=$USER_ZDOTDIR/.zsh_history …Run Code Online (Sandbox Code Playgroud) 我bash在 MacOS 上使用 shell 感觉很舒服。但卡特琳娜将其替换为zsh.
为什么?我可以把它切换回来吗?
如果是这样,怎么办?
这样做有意义吗?有什么问题吗?
我的.Zshrc中有以下代码
function google; {
$VIEW "http://www.google.com/search?q='url-encode "${(j: :)@}"'"
}
Run Code Online (Sandbox Code Playgroud)
我明白了
google masi
google:1: no such file or directory: http://www.google.com/search?q='url-encode masi'
Run Code Online (Sandbox Code Playgroud)
如何让Google搜索在Zsh中运行?
我试着写一个脚本用gentoos java-config编译java文件,但我最终得到一个错误zsh:解析错误:条件预期:"$ 1"任何人都可以告诉我这意味着什么以及为什么它会在第16行报告功能.
function jComp() {
local java_mods = ""
if (( $# == 0)); then
echo "using javac on .java in folder"
`javac *.java`
return 0
elif [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then
echo "Usage: jComp [java modules] [file]"
echo
echo "Options:"
echo " -h, This help message."
echo "modules has to be in the (java-config -l) list"
echo
echo "Report bugs to <tellone.diloom@gmail.com>."
return 0
fi
if [[ "$(java-config -v)" == "" …Run Code Online (Sandbox Code Playgroud) 我有一个脚本调用一个新的shell并运行一个生成的命令.这是典型命令的样子:
exec nocorrect vim file:///rails_app/app/controllers/cow_controller.rb +214
我认为添加'nocorrect'可以解决我的问题,但是当上面的行运行时,我仍然得到'zsh:correct'vim'到'.vim'[nyae]?' .我错过了什么?
(对于后台,我使用better_errors生成带行号的URL,vim _in_iterm作为将命令字符串传递给zsh的协议处理程序)
我正在编写一个shell脚本,我设置的变量很少,其值是命令的输出.
我得到的错误是:
$ $tag_name="proddeploy-$(date +"%Y%m%d_%H%M")"
-bash: =proddeploy-20141003_0500: command not found
Run Code Online (Sandbox Code Playgroud)
现在,我确实阅读了其他类似的问题并在此基础上尝试了各种各样的事情:
$ $deploy_date=date +"%Y%m%d_%H%M"
bash: =date: command not found
$ $tag_name="proddeploy-$deploy_date"
bash: proddeploy- command not found
Run Code Online (Sandbox Code Playgroud)
$ $tag_name=`proddeploy-$(date +"%Y%m%d_%H%M")`
bash: proddeploy-20141003_1734: command not found
bash: =: command not found
Run Code Online (Sandbox Code Playgroud)
$()$ $tag_name=$(proddeploy-$(date +"%Y%m%d_%H%M"))
bash: proddeploy-20141003_1735: command not found
bash: =: command not found
Run Code Online (Sandbox Code Playgroud)
但在每种情况下,命令输出都会被执行.如何让它停止执行命令输出并只存储为变量?我需要这个在ZSH和BASH上工作.
从我将Mavericks升级到优胜美地以来,这是我每次启动Terminal.app时都会看到的内容:
dyld: Library not loaded: /usr/local/lib/libpcre.1.dylib
Referenced from: /usr/local/bin/zsh
Reason: image not found
zsh: trace trap
/Users/user/sandbox/repos/zsh-notify/notify.plugin.zsh:55: command not found: add-zsh-hook
/Users/user/sandbox/repos/zsh-notify/notify.plugin.zsh:56: command not found: add-zsh-hook
Run Code Online (Sandbox Code Playgroud)
为了查看权限是否被弄乱了,我检查了
? exp-scotty where zsh
/usr/local/bin/zsh
/usr/local/bin/zsh
/bin/zsh
/bin/zsh
? exp-scotty ll `where zsh`
-rwxr-xr-x 1 root wheel 538K Sep 10 01:19 /bin/zsh
-rwxr-xr-x 1 root wheel 538K Sep 10 01:19 /bin/zsh
lrwxr-xr-x 1 milan admin 27B Oct 28 10:59 /usr/local/bin/zsh -> ../Cellar/zsh/5.0.7/bin/zsh
lrwxr-xr-x 1 milan admin 27B Oct 28 10:59 /usr/local/bin/zsh -> ../Cellar/zsh/5.0.7/bin/zsh …Run Code Online (Sandbox Code Playgroud) 我正在加入一个简短的命令,以我的.zshrc文件,将调用clear,ls和git status.git status只有当前目录是git项目的一部分时,才应调用该命令.
到目前为止,我有一个可行的版本,但只有当.git文件实际位于当前目录中时,才会在项目的根目录中.看起来像这样:
alias cl="clear && ls && if [ -e .git ]
then
git status
fi"
Run Code Online (Sandbox Code Playgroud)
我想知道是否有办法检查.git当前目录的任何父目录中是否有文件 - 或者是否有其他方法可以实现此目的.
谢谢!
我的.zshrc文件中有一个别名,称为“管家”,如下所示:
alias housekeeping="git fetch -p && git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -d"
Run Code Online (Sandbox Code Playgroud)
当我运行此命令时,由于某种原因,我得到以下输出:
error: The branch '12795-add-ship-info-to-FAQ' is not fully merged.
If you are sure you want to delete it, run 'git branch -D 12795-add-ship-info-to-FAQ'.
error: branch '97167bb3f' not found.
error: branch '[origin/12795-add-ship-info-to-FAQ:' not found.
error: branch 'gone]' not found.
error: branch 'Edits' not found.
error: branch 'to' not found.
error: branch 'text' not found.
Run Code Online (Sandbox Code Playgroud)
看起来好像传递了错误的论点。
但是,当我直接从终端运行完全相同的命令时,确实得到了预期的结果。
我究竟做错了什么?
我需要用等价的小写字母替换php应用程序中的所有include。我正在将旧版应用程序转换为Docker,并且该应用程序是在Windows中构建的。
我已经测试了以下正则表达式
(include.+)["'](\w+\.php)["'](.*)
Run Code Online (Sandbox Code Playgroud)
我已经尝试将其放入这样的单线perl命令中
perl -p -i -e '/(include.+)[\"\'](\w+\.php)[\"\'](.*)/\1\'\L\2\'\E\3/ `find ./ -name *.php`
Run Code Online (Sandbox Code Playgroud)
但我得到一个错误
(在'L2'之前缺少运算符??)在“ -L2'E3”附近的-e行1中,期望找到运算符的地方(在E3之前缺少运算符?)在-e第1行末尾的未知正则表达式修饰符“ / 1” -e第1行的行语法错误在“ /(include.+)[\"](w+.php)"'/1'L2'”附近-e的执行由于编译错误而中止。
我只需要将匹配的字符串替换为,$1'{lowercase $2}'$3但是我并不是一个perl或sed向导。
编辑
php的两个示例包括声明
include "something.php";
include_once "something.php";
include("SomethingElse.php");
include ('Something.php');
include_once("something.php");
include_once ("something.php");
Run Code Online (Sandbox Code Playgroud)