How to configure git bash command line completion?

On Linux On most distributions, git completion script is installed into /etc/bash_completion.d/ (or /usr/share/bash-completion/completions/git) when you install git, no need to go to github. You just need to use it – add this line to your .bashrc: In some versions of Ubuntu, git autocomplete may be broken by default, reinstalling by running this command should fix it: On Mac … Read more

What is a simple explanation for how pipes work in Bash?

A Unix pipe connects the STDOUT (standard output) file descriptor of the first process to the STDIN (standard input) of the second. What happens then is that when the first process writes to its STDOUT, that output can be immediately read (from STDIN) by the second process. Using multiple pipes is no different than using … Read more

Difference between sh and Bash

What is sh? sh (or the Shell Command Language) is a programming language described by the POSIX standard. It has many implementations (ksh88, Dash, …). Bash can also be considered an implementation of sh (see below). Because sh is a specification, not an implementation, /bin/sh is a symlink (or a hard link) to an actual implementation on most POSIX systems. What is Bash? Bash … Read more

Print array elements on separate lines in Bash?

Try doing this : The difference between $@ and $*: Unquoted, the results are unspecified. In Bash, both expand to separate args and then wordsplit and globbed. Quoted, “$@” expands each element as a separate argument, while “$*” expands to the args merged into one argument: “$1c$2c…” (where c is the first char of IFS). You almost always want “$@”. Same goes for “${arr[@]}”. Always quote them!

Extract filename and extension in Bash

First, get file name without the path: Alternatively, you can focus on the last ‘/’ of the path instead of the ‘.’ which should work even if you have unpredictable file extensions: You may want to check the documentation : On the web at section “3.5.3 Shell Parameter Expansion“ In the bash manpage at section … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)