zsh

What is the zsh equivalent for $BASH_REMATCH[]?

我怕爱的太早我们不能终老 提交于 2020-12-30 01:42:20
问题 What is the equivalent in zsh for $BASH_REMATCH , and how is it used? 回答1: To make zsh behave the same as bash , use: setopt BASH_REMATCH Or within a function consider: setopt local_options BASH_REMATCH (this will only set the option within the scope of the function) Then just use $BASH_REMATCH as you would in bash . The manual says about BASH_REMATCH : When set, matches performed with the =~ operator will set the BASH_REMATCH array variable, instead of the default MATCH and match variables.

What is the zsh equivalent for $BASH_REMATCH[]?

 ̄綄美尐妖づ 提交于 2020-12-30 01:36:47
问题 What is the equivalent in zsh for $BASH_REMATCH , and how is it used? 回答1: To make zsh behave the same as bash , use: setopt BASH_REMATCH Or within a function consider: setopt local_options BASH_REMATCH (this will only set the option within the scope of the function) Then just use $BASH_REMATCH as you would in bash . The manual says about BASH_REMATCH : When set, matches performed with the =~ operator will set the BASH_REMATCH array variable, instead of the default MATCH and match variables.

What is the zsh equivalent for $BASH_REMATCH[]?

自闭症网瘾萝莉.ら 提交于 2020-12-30 01:34:43
问题 What is the equivalent in zsh for $BASH_REMATCH , and how is it used? 回答1: To make zsh behave the same as bash , use: setopt BASH_REMATCH Or within a function consider: setopt local_options BASH_REMATCH (this will only set the option within the scope of the function) Then just use $BASH_REMATCH as you would in bash . The manual says about BASH_REMATCH : When set, matches performed with the =~ operator will set the BASH_REMATCH array variable, instead of the default MATCH and match variables.

Why does sh interpret these commands differently to zsh?

狂风中的少年 提交于 2020-12-07 16:42:04
问题 Context: I am trying to get the names of fonts installed on my Linux machine. The name is between two colons. When I run this script using zsh, it works. When I switch to sh it breaks. It probably deletes \n characters, because the output is all one line. cmd="$(fc-list)" names="$(echo $cmd | grep -oP "(?<=: ).*?(?=:)")" echo $names Which command causes the issues? Is it not POSIX compliant? 回答1: Why does sh interpret these commands differently to zsh? Because they are different shell the

Why does sh interpret these commands differently to zsh?

核能气质少年 提交于 2020-12-07 16:39:25
问题 Context: I am trying to get the names of fonts installed on my Linux machine. The name is between two colons. When I run this script using zsh, it works. When I switch to sh it breaks. It probably deletes \n characters, because the output is all one line. cmd="$(fc-list)" names="$(echo $cmd | grep -oP "(?<=: ).*?(?=:)")" echo $names Which command causes the issues? Is it not POSIX compliant? 回答1: Why does sh interpret these commands differently to zsh? Because they are different shell the

Git tab completion not working in zsh on mac

不问归期 提交于 2020-11-30 02:45:09
问题 No matter what I try and do I can't seem to make git tab/auto completion work in my zsh shell. I've downloaded the bash-completion script and the zsh-completion one and followed the instructions, but I can't make it work. I've reinstalled oh-my-zsh but that didn't seem to help or make any difference. Can anyone who's got it working describe to me their setup so I can try an emulate it to get it working for me? To be specific, what I've done so far is: Switched to using zsh as my default shell

Git tab completion not working in zsh on mac

妖精的绣舞 提交于 2020-11-30 02:44:23
问题 No matter what I try and do I can't seem to make git tab/auto completion work in my zsh shell. I've downloaded the bash-completion script and the zsh-completion one and followed the instructions, but I can't make it work. I've reinstalled oh-my-zsh but that didn't seem to help or make any difference. Can anyone who's got it working describe to me their setup so I can try an emulate it to get it working for me? To be specific, what I've done so far is: Switched to using zsh as my default shell

Linux 如何高效回退到特定层级目录?

空扰寡人 提交于 2020-11-25 03:40:10
Linux 下如果我们进入到了一个比较长的路径,比如: /home/alvin/projects/blogdemos/linux-system-programming/thread /home/alvin/projects/blogdemos/diff /home/harry/study/ 亚洲文化 /日本文化/ 中日交流 /影视业/ 动作片 如果我们想要回退到一个特定的父目录,那么我们通常的做法是这样敲: $ cd ../../../ 如果层级比较少,那这样勉强还可以接受,但如果层级很深,那可能就会 cd 到你怀疑人生了。 本文将介绍一个工具,它能帮你快速进入到某一个特定的父目录,而无需一路 cd 。你可以直接指定回退的层级数,或者要回退的目标目录,非常方便。 更重要的是,它甚至还支持 tab 键,而且在不重复的情况下,你也可以指定目标目录的前几个字母即可,大大增加了工作效率。 这个工具其实就是个 shell 脚本,名字是 up.sh ,除了支持 bash 外,对 zsh 和 fish shell 的支持也很好。 up 脚本的安装 这个脚本是第三方人员开发的,所以需要我们人为安装到我们的系统。 首先,我们需要先将 up.sh 下载到我们本地,然后再使能这个脚本: $ curl --create-dirs -o ~/.config/up/up.sh https: //raw

pyenv 让 python 版本完美切换

吃可爱长大的小学妹 提交于 2020-11-14 12:57:32
前言 我觉得如果使用 python 开发的话,还是在 unix/linux 的环境下吧,shell 工具的效率比 windows 高得多,尽管 windows 下也有 cmder 这种神器,而且现在 windows store 也很好的开发出了 linux 子系统,但是瑕疵非常多,unix/linux 才是完美的环境。本文用到的是 archlinux ,另外 debian/ubuntu、centos 也完全适用。mac 用户也可以参考,不过 homebrew 也提供了非常方便的安装方法,但是建议使用文本做法。 背景 python 版本比较多,2 和 3 相差非常大,很多项目需要跑在同一台服务器上,我们可以选择直接运行,也可以选择使用 docker。如果用 docker 那就不需要隔离环境了,如果要直接运行在服务器上,那就必须有隔离环境。比如有的项目使用 python 3.5,有的项目使用 python 3.7,此时我们可以借助 pyenv 帮助我们完美的隔离环境,让多个版本的 python 没有任何冲突,完美共存。 任务 使用 pyenv 和 pyenv-virtualenv ,在 linux 下完美隔离 python 各个版本 第 1 章:使用环境 操作系统: archlinux shell: zsh 请注意,接下来所有的操作都在 archlinux 下进行,本文不涉及

腾讯云 Serverless 使用,及部署 Docusaurus

老子叫甜甜 提交于 2020-11-11 10:19:59
代码: https://github.com/ikuokuo/start-serverless 前提准备 npm install -g serverless npm update -g serverless ❯ serverless -v Framework Core: 2.8.0 Plugin: 4.1.1 SDK: 2.3.2 Components: 3.2.7 快速部署 ❯ serverless Serverless: 当前未检测到 Serverless 项目,是否希望新建一个项目? Yes Serverless: 请选择你希望创建的 Serverless 应用 vue-starter - 快速部署一个 Vue.js 基础应用 Serverless: 请输入项目名称 demo Serverless: 正在安装 vue-starter 应用... vue-starter › Created demo 项目已成功创建! Serverless: 是否希望立即将该项目部署到云端? Yes Please scan QR code login from wechat. Wait login... Login successful for TencentCloud. serverless ⚡framework Action: "deploy" - Stage: "dev" - App: