zsh

What does “export” do in shell programming? [duplicate]

这一生的挚爱 提交于 2019-11-26 10:16:23
问题 This question already has an answer here: Defining a variable with or without export 14 answers As far as I can tell, variable assignment is the same whether it is or is not preceded by \"export\". What\'s it for? 回答1: Exported variables such as $HOME and $PATH are available to (inherited by) other programs run by the shell that exports them (and the programs run by those other programs, and so on) as environment variables. Regular (non-exported) variables are not available to other programs.

npm global path prefix

女生的网名这么多〃 提交于 2019-11-26 09:53:41
I am being more cautious than usual because I have been confused by the behavior of npm in the past. I am on a Mac and have installed node.js through brew install node . Now that I want to run jslint.js on the command-line as the command jslint I find that the canonical way to accomplish this is sudo npm install -g jslint which ran successfully with this output: $ sudo npm install -g jslint npm http GET https://registry.npmjs.org/jslint npm http 200 https://registry.npmjs.org/jslint npm http GET https://registry.npmjs.org/jslint/-/jslint-0.1.9.tgz npm http 200 https://registry.npmjs.org/jslint

Can I alias a subcommand? (shortening the output of `docker ps`)

烂漫一生 提交于 2019-11-26 08:27:11
问题 The docker command has a ps sub-command that emits very long lines: $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6e8ec8a16da4 waisbrot/wait:latest \"/wait\" 4 minutes ago Exited (0) 4 minutes ago wait-for-janus-test 9dbf0739561f whoop/downsampler:master \"./run.bash\" 4 minutes ago Up 4 minutes 0.0.0.0:32855->4369/tcp, 0.0.0.0:32854->9100/tcp, 0.0.0.0:32853->9101/tcp, 0.0.0.0:32852->9102/tcp, 0.0.0.0:32851->9103/tcp, 0.0.0.0:32850->9104/tcp, 0.0.0.0:32849->9105/tcp, 0

Git branch command behaves like 'less'

痴心易碎 提交于 2019-11-26 07:52:15
问题 When I use the git branch command to list all branches, I see the output of git branch | less . The command git branch is supposed to show a list of branches, like ls does for files. This is the output I get: How do I get the default behaviour of git branch ? What causes the paged output? I am using ZSH with oh_my_zsh (nothing for Git in there), and my .gitconfig looks like this: [user] email = myemail@mail.com name = Dennis Haegler [push] default = simple [merge] tool = vimdiff [core] editor

Rails keeps telling me that it's not currently installed

流过昼夜 提交于 2019-11-26 05:17:01
问题 I use rvm to manage different rubies and their gemsets. My shell is zsh with oh-my-zsh configured with basic settings. Enabled oh-my-zsh plugins are ruby, rails, osx, and git. Here\'s the command I used to install ruby-1.8.7 and rails-3.0.7. rvm install 1.8.7 rvm use 1.8.7 gem install rails -v=3.0.7 and then I typed rails and got: Rails is not currently installed on this system. To get the latest version, simply type: $ sudo gem install rails You can then rerun your \"rails\" command. I\'ve

npm global path prefix

不想你离开。 提交于 2019-11-26 01:51:06
问题 I am being more cautious than usual because I have been confused by the behavior of npm in the past. I am on a Mac and have installed node.js through brew install node . Now that I want to run jslint.js on the command-line as the command jslint I find that the canonical way to accomplish this is sudo npm install -g jslint which ran successfully with this output: $ sudo npm install -g jslint npm http GET https://registry.npmjs.org/jslint npm http 200 https://registry.npmjs.org/jslint npm http

How to add a progress bar to a shell script?

喜夏-厌秋 提交于 2019-11-25 22:48:56
问题 When scripting in bash or any other shell in *NIX, while running a command that will take more than a few seconds, a progress bar is needed. For example, copying a big file, opening a big tar file. What ways do you recommend to add progress bars to shell scripts? 回答1: You can implement this by overwriting a line. Use \r to go back to the beginning of the line without writing \n to the terminal. Write \n when you're done to advance the line. Use echo -ne to: not print \n and to recognize

How to permanently set $PATH on Linux/Unix?

血红的双手。 提交于 2019-11-25 21:56:37
问题 I\'m trying to add a directory to my path so it will always be in my Linux path. I\'ve tried: export PATH=$PATH:/path/to/dir This works, however each time I exit the terminal and start a new terminal instance, this path is lost, and I need to run the export command again. How can I do it so this will be set permanently? 回答1: There are multiple ways to do it. The actual solution depends on the purpose. The variable values are usually stored in either a list of assignments or a shell script