zsh

/bin/bash printf does not work with other LANG than C

六眼飞鱼酱① 提交于 2019-12-10 13:56:19
问题 I have a really weird problem with /bin/bash and a script that uses printf to format a string. My script looks like this rt=$(printf "%.3f" 13.234324245) with the difference, that i compute the number 13.23... above. When i use /usr/bin/zsh that works great! Even /bin/sh can do it (but it cant do the if stuff...) The biggest problem ist that /bin/bash seems to does not understand printf or does have another formating way when i dont use LANG=C . My LANG Variable is set to de_AT.UTF-8 and then

item2 配色方案 oh my zsh

蹲街弑〆低调 提交于 2019-12-10 13:36:51
最终效果图 下载item2配色包 http://iterm2colorschemes.com 下载然后倒入到item2中 使用的颜色是 在配合oh my zsh GitHub地址 https://github.com/ohmyzsh/ohmyzsh 终端输入命令 sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" 等执行完成配色方案就完成了 来源: https://www.cnblogs.com/ZhangShengjie/p/12016104.html

format and filter file to Csv table

喜你入骨 提交于 2019-12-10 12:23:24
问题 I have a file that contains many logs : Ps: the question is inspired from a previous question here. but slightly improved. at 10:00 carl 1 STR0 STR1 STR2 STR3 <STR4 STR5> [STR6 STR7] STR8: academy/course1:oftheory:SMTGHO:nothing: academy/course1:ofapplicaton:SMTGHP:onehour: at 10:00 carl 2 STR0 STR1 STR2 STR3 <STR4 STR78> [STR6 STR111] STR8: academy/course2:oftheory:SMTGHM:math: academy/course2:ofapplicaton:SMTGHN:twohour: at 10:00 david 1 STR0 STR1 STR2 STR3 <STR4 STR758> [STR6 STR155] STR8:

tmux: how to open file under cursor

白昼怎懂夜的黑 提交于 2019-12-10 10:40:14
问题 i am a vim user and got used to the gf command, which opens the file under the cursor. Now i wanted to ask, if there is something like that for tmux. I can navigate through a tmux-pane and it happens often that there is a file-path under the cursor. Now i like to have the possibility to open that file under the cursor with vim. A: in the current window B: in another window which includes and opened vim Maybe there is a possibility to run a sh-script in that navigation-mode when invoking a

References to $RANDOM in subshells all returning identical values

醉酒当歌 提交于 2019-12-10 09:45:13
问题 The following short script prints a random ten-digit binary number: #!/usr/bin/zsh point='' for i in `seq 1 10` do echo $RANDOM >/dev/null point=$point`if [ $RANDOM -gt 16383 ]; then echo 0; else echo 1; fi` done echo $point However, if I remove the apparently useless echo $RANDOM >/dev/null line, the script always prints either 1111111111 or 0000000000 . Why? 回答1: From the man page: The values of RANDOM form an intentionally-repeatable pseudo-random sequence; subshells that reference RANDOM

iterm2远程ssh连接服务器乱码问题

杀马特。学长 韩版系。学妹 提交于 2019-12-10 06:22:12
服务器是Linux,用Mac的iterm2 ssh连上去,中文显示乱码,也不能输入中文,然而本地终端可以显示和输入 原因: 终端和服务器的字符集不匹配,MacOSX下默认的是utf8字符集 解决方法: 1.打开配置文件(此处使用zsh) vim ~/.zshrc 2.在文件里面添加如下内容 export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 接着重启一下终端,或者输入 source ~/.zshrc 使设置生效。 PS:远端服务器和本地服务器都需要修改,一致即可。 来源: oschina 链接: https://my.oschina.net/u/228302/blog/2221635

What special meaning does an equal-sign have in zsh?

落爺英雄遲暮 提交于 2019-12-10 02:52:28
问题 In my zsh script, I had a line echo some text ================================ To my surprise, an error message was issued for this line: zsh: =============================== not found Experimenting from the command line, I found that the shell gets upset when there is an equal sign: $ echo =z zsh: z not found But here, we have: $ echo =echo /usr/bin/echo From this observation, it looks, as if =XXX would be interpreted like $(which XXX) However, I didn't find anything about this "substitution

Shell execution: time vs. /usr/bin/time

前提是你 提交于 2019-12-10 02:04:27
问题 What is going on when bash/zsh does the following: ~ » /usr/bin/time -l sleep 1 1.00 real 0.00 user 0.00 sys 516096 maximum resident set size 0 average shared memory size 0 average unshared data size 0 average unshared stack size 145 page reclaims 0 page faults 0 swaps 0 block input operations 0 block output operations 0 messages sent 0 messages received 0 signals received 0 voluntary context switches 2 involuntary context switches ------------------------------------------------------------

What's the correct way to redirect both stdout and stderr in bash? [duplicate]

大城市里の小女人 提交于 2019-12-10 01:59:09
问题 This question already has answers here : Redirect stderr and stdout in Bash (15 answers) Closed 3 years ago . Here's the concrete task I'm trying to accomplish. zsh behaves the way I like $ zsh $ which clang > /dev/null 2&>1 && echo clang || echo gcc clang $ which doesntexist > /dev/null 2&>1 && echo doesntexist || echo gcc gcc But, in bash: $ bash $ which clang > /dev/null 2&>1 && echo clang || echo gcc gcc Here's the general case: $ which clang > /dev/null 2&>1; echo $? 1 $ which clang;

ubuntu安装oh my zsh

别来无恙 提交于 2019-12-10 00:20:09
安装 zsh sudo apt-get install zsh 安装 oh my zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh )" 3.参考 * https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH * https://github.com/robbyrussell/oh-my-zsh 来源: oschina 链接: https://my.oschina.net/u/2279209/blog/695228