15 Matching Annotations
  1. Dec 2018
  2. Oct 2018
  3. Jun 2018
  4. Dec 2017
    1. #!/bin/sh(cat <<EOFstart(){    echo "start"}EOF) >/tmp/b

      shell 如何把多行内容输出到一个文件

  5. Oct 2017
  6. Feb 2017
    1. A shell script is a file of executable commands that has been stored in a text file. When the file is run, each command is executed.

      The power of BASH!

  7. Aug 2015
  8. May 2015
    1. You can push an alternative branch to Heroku using Git. git push heroku-dev test:master This pushes your local test branch to the remote's master branch (on Heroku).

      Push a local non-master branch to heroku master

    1. Every shell has some startup files that it consults for its configuration. Zsh has system-wide startup items in /etc/ (or, in distributions such as Ubuntu, in /etc/zsh/) and user-specific startup files (in the home directory). When Zsh starts up, it reads the following things in this order: /etc/zshenv and ~/.zshenv If the shell is a login shell: /etc/zprofile and ~/.zprofile If it’s an interactive shell: /etc/zshrc and ~/.zshrc If the shell is a login shell: /etc/zlogin and ~/.zlogin And when a user logs out from a login shell, Zsh reads /etc/zlogout and ~/.zlogout. To work out which commands you have to write in which startup files, it's important to know the different types of shells. A login shell is one that's spawned when you log in - for example, via SSH or on a virtual terminal. An interactive shell displays a prompt to the user where you can type commands - for instance, when you open a terminal window in Ubuntu. However, if you run ssh host somecommand, then this is a login shell, but is in fact a non-interactive one.
    2. Every shell has some startup files that it consults for its configuration. Zsh has system-wide startup items in /etc/ (or, in distributions such as Ubuntu, in /etc/zsh/) and user-specific startup files (in the home directory). When Zsh starts up, it reads the following things in this order: /etc/zshenv and ~/.zshenv If the shell is a login shell: /etc/zprofile and ~/.zprofile If it’s an interactive shell: /etc/zshrc and ~/.zshrc If the shell is a login shell: /etc/zlogin and ~/.zlogin And when a user logs out from a login shell, Zsh reads /etc/zlogout and ~/.zlogout. To work out which commands you have to write in which startup files, it's important to know the different types of shells. A login shell is one that's spawned when you log in - for example, via SSH or on a virtual terminal. An interactive shell displays a prompt to the user where you can type commands - for instance, when you open a terminal window in Ubuntu. However, if you run ssh host somecommand, then this is a login shell, but is in fact a non-interactive one.
    3. There's also a function periodic() that is executed every PERIOD seconds if the latter variable is set.

      Periodic commands in ZSH

    4. Zsh also makes it possible to run particular code automatically on certain occasions. You just have to define some special functions. The two most frequently used are chpwd and precmd. Zsh calls the former each time the current directory changes. The latter is called just before Zsh shows you a new prompt. Both functions are regularly used to show the current directory in the title bar of your terminal emulator. If you use programs other than the shell, which alter the title of your terminal emulator (Vim is one example), you should use precmd - it restores the title after another command has run. So this is how we show the current directory in the title bar (adapted from the manual page):

      Run commands

    5. REPORTTIME=5 TIMEFMT="%U user %S system %P cpu %*Es total"

      Report times of long running shell commands