What does set -e mean in a bash script?

From help set : -e Exit immediately if a command exits with a non-zero status. But it’s considered bad practice by some (bash FAQ and irc freenode #bash FAQ authors). It’s recommended to use: trap ‘do_something’ ERR to run do_something function when errors occur. See http://mywiki.wooledge.org/BashFAQ/105

What is the meaning of “POSIX”?

POSIX is a family of standards, specified by the IEEE, to clarify and make uniform the application programming interfaces (and ancillary issues, such as commandline shell utilities) provided by Unix-y operating systems. When you write your programs to rely on POSIX standards, you can be pretty sure to be able to port them easily among … Read more

Where can I find php.ini?

On the command line execute: php –ini You will get something like: Configuration File (php.ini) Path: /etc/php5/cli Loaded Configuration File: /etc/php5/cli/php.ini Scan for additional .ini files in: /etc/php5/cli/conf.d Additional .ini files parsed: /etc/php5/cli/conf.d/curl.ini, /etc/php5/cli/conf.d/pdo.ini, /etc/php5/cli/conf.d/pdo_sqlite.ini, /etc/php5/cli/conf.d/sqlite.ini, /etc/php5/cli/conf.d/sqlite3.ini, /etc/php5/cli/conf.d/xdebug.ini, /etc/php5/cli/conf.d/xsl.ini That’s from my local dev-machine. However, the second line is the interesting one. If there is … Read more

How to permanently set $PATH on Linux/Unix [closed]

You need to add it to your ~/.profile or ~/.bashrc file.  export PATH=”$PATH:/path/to/dir” Depending on what you’re doing, you also may want to symlink to binaries: cd /usr/bin sudo ln -s /path/to/binary binary-name Note that this will not automatically update your path for the remainder of the session. To do this, you should run: source … Read more

How do I use sudo to redirect output to a location I don’t have permission to write to? [closed]

Your command does not work because the redirection is performed by your shell which does not have the permission to write to /root/test.out. The redirection of the output is not performed by sudo. There are multiple solutions: Run a shell with sudo and give the command to it by using the -c option: sudo sh … Read more

Using ls to list directories and their total sizes [closed]

Try something like: du -sh * short version of: du –summarize –human-readable * Explanation: du: Disk Usage -s: Display a summary for each specified file. (Equivalent to -d 0) -h: “Human-readable” output. Use unit suffixes: Byte, Kibibyte (KiB), Mebibyte (MiB), Gibibyte (GiB), Tebibyte (TiB) and Pebibyte (PiB). (BASE2)

Git replacing LF with CRLF

These messages are due to an incorrect default value of core.autocrlf on Windows. The concept of autocrlf is to handle line endings conversions transparently. And it does! Bad news: the value needs to be configured manually. Good news: it should only be done one time per Git installation (per project setting is also possible). How … Read more

Defining a variable with or without export

export makes the variable available to sub-processes. That is, export name=value means that the variable name is available to any process you run from that shell process. If you want a process to make use of this variable, use export, and run the process from that shell. name=value means the variable scope is restricted to … Read more

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