zsh

How to make zsh run as a login shell on Mac OS X (in iTerm)?

耗尽温柔 提交于 2019-11-29 18:36:21
When zsh is set as a login shell on Mac OS X, when it is started by iTerm, zsh doesn't consider that it's being run as a login shell, although it's started as ‘-zsh’ (‘-’ is put as the first character of arg[0]) which is supposed to mean that it should start as a login shell. So, when I set the login shell to bash, bash recognizes this first ‘-’ in $0 and runs as a login shell, but zsh doesn't, although it seems that it should. Is there a way to either make zsh recognize the ‘-’ in the arg[0], or make iTerm run the shell with a --login command line argument? chsh -s $(which zsh) You'll be

git bash auto complete slow on windows 7 x64

佐手、 提交于 2019-11-29 17:41:21
问题 I have two machines where git bash auto complete is agonizingly slow. When I hit tab, it can take 8 to 10 seconds for the filename to be completed. This only seems to happen when the auto complete is part of a git command. Auto complete for cd works fine. The actual execution of the git command runs fine. I am using git version 1.8.3-preview20130601 $ git count-objects -vH count: 9 size: 10.23 KiB in-pack: 2488 packs: 1 size-pack: 18.68 MiB prune-packable: 0 garbage: 0 size-garbage: 0 bytes

How can you use pure unset shell builtin? Can you write shell scripts that are immune to tampering?

萝らか妹 提交于 2019-11-29 16:12:22
问题 I mean I want to use unset that is not a shell function itself. If I could do that, I could make sure that command is pure by running #!/bin/sh { \unset -f unalias command [; \unalias unset command [ } 2>/dev/null; # make zsh find *builtins* with `command` too: [ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on If I am using Debian Almquist shell (dash), I think I can rely that \unset is pure. At least I could not define a shell function named unset in dash . Whereas in bash or in zsh I

oh my zsh docker 补全不生效问题

☆樱花仙子☆ 提交于 2019-11-29 15:03:56
按照官方文档安装了 zsh oh my zsh docker-ce 就当在zsh启用docker插件的时候 死活 docker 2次tab 过后不出来 基本上没人遇到这个问题。 百度几乎没有头绪。 谷歌到:stackoverflow https://stackoverflow.com/questions/37428133/zsh-docker-plugin-not-working# 应该是删除 缓存文件 rm ~/.zcompdump* 然后重新登陆zsh 果然好使!!! 如果oh my zsh 使用tab 补全不生效,估计百分之九十九是这个问题。 github 问题链接: https://github.com/robbyrussell/oh-my-zsh/issues/7642 感谢您的报道,并分享了移除.zcompdump的工作.档案。这让我快疯了! 来源: https://my.oschina.net/VASKS/blog/3106041

How to disable zsh substitution/autocomplete with URL and backslashes

浪尽此生 提交于 2019-11-29 14:41:58
问题 I am using zsh with oh-my-zsh on Ubuntu:14.04. The shell autocompletes escape character with backslash when I paste a URL. For example with environment variables: $ wget http://{DEFAULT_IP}/index.html It will become: $ wget http://\{DEFAULT_IP\}/index.html How can I disable this function? 回答1: update 2019-05-12: new version(> 486fa10) oh-my-zsh have a configuration for this, add DISABLE_MAGIC_FUNCTIONS=true before source $ZSH/oh-my-zsh.sh : DISABLE_MAGIC_FUNCTIONS=true source $ZSH/oh-my-zsh

How to show battery status in Zsh prompt

混江龙づ霸主 提交于 2019-11-29 14:41:14
问题 I think the answer is quite self explanatory. I've been looking around for a software that already does this but I haven't had any luck. It's either not done in Zsh, or it's for another app, for example tmux. Point is I haven't been able to find it. So my question is, is there already a pre-made script that somebody did that does this? If there is, could you please share a link to it. If there isn't, what should I look into to making this script? I'm a newbie at Zsh scripting so bear that in

How to evaluate a shell variable each time it's used

倾然丶 夕夏残阳落幕 提交于 2019-11-29 14:31:57
Related to a similar problem I'm having: zsh not re-computing my shell prompt Is there any way to define a shell variable such that its value is calculated each time its called? for example if I do: my_date="today is $(date)" The value in my_date would be: today is Thu Aug 9 08:06:18 PDT 2012 but I want the date to be executed each time my_date is used. In the linked post, somebody recommended putting the value in single quotes: my_date='today is $(date)' but never evaluates anything, it just stays literally at $(date). I'm using zsh 5.0.0 That's not possible. Use a function instead: my_date()

Why does a cURL request return a percent sign (%) with every request in ZSH?

▼魔方 西西 提交于 2019-11-29 13:12:14
I've noticed that the return from any cURL request in ZSH ends in a % , for example: $ curl http://textbelt.com/text -d number="555555555" -d message="hey" => { "success": true }% Why is this character being added and is there a standard method for removing it? note: ZSH is the only shell that I notice this occurring (tested in bash csh ksh sh tcsh zsh) This is a zsh feature that prints a percent-and-newline after a command completes if that command does not already include a newline at the end of its output. If zsh did not do this, you would either not ever notice the fact that the command

Prevent “echo” from interpreting backslash escapes

强颜欢笑 提交于 2019-11-29 12:23:25
I'd like to echo something to a file that contains new line escape sequences, however I would like them to remain escaped. I'm looking for basically the opposite to this question. echo "part1\npart2" >> file I would like to look like this in the file $ cat file old part1\npart2 but it looks like $ cat file old part1 part2 This is a good example of why POSIX recommends using printf instead of echo (see here , under "application usage"): you don't know what you get with echo . You could get: A shell builtin echo that does not interpret backslash escapes by default Example: the Bash builtin echo

安装软件包的三种方法,rpm包介绍,rpm工具用法,yum工具用法,yum搭建本地仓库

谁都会走 提交于 2019-11-29 11:16:47
安装软件包的三种方法 三种方法分别是:rpm包,yum工具,源码包 rpm包类似windows的安装程序 但是有一个问题,有时候要安装rpm包 A 是需要一些依赖包才能安装的,比如rpm包 B 如果不先安装依赖包,rmp包B,是不能安装rpm包A的 所以比较繁琐 yum工具的好处是,使用yum工具安装rpm包A的时候 yum工具可以自动安装依赖包,rpm包 B 所以就很方便 源码包就是用编程语言写的程序文件 需要把程序文件用编译软件编译成二进制文件 才可以使用 rpm 包介绍 如图,点击虚拟机光盘图标,选择连接 如图,使用命令将 cdrom 设备文件挂载到 /mnt/ 目录下面 写保护是因为用户不能对cdrom进行写入操作 上图可以看到,进入/mnt/目录,看到的文件就是光驱里面的内容 cd Packages/ 进入 Packages 目录 使用ls命令 可以看到许多以 .rpm 结尾的文件,这些都是rpm包 第一个箭头是指包名称 第二个箭头是版本号,第三个箭头是次版本号,第四个箭头是再次的版本号 第五六个箭头是发布版本号 第七个箭头是平台位数,32或者64位,这里是64位的 64位系统可以安装32位的包,但是32位系统不能安装64位的包 rpm工具用法 参数 -ivh , i是install,v是可视化,h是人性化的显示 使用以上参数来安装 rpm 包