What does set -e mean in a bash script?

From help set : But it’s considered bad practice by some (bash FAQ and irc freenode #bash FAQ authors). It’s recommended to use: to run do_something function when errors occur. See http://mywiki.wooledge.org/BashFAQ/105

How to sort an array in Bash

You don’t really need all that much code: Supports whitespace in elements (as long as it’s not a newline), and works in Bash 3.x. e.g.: Note: @sorontar has pointed out that care is required if elements contain wildcards such as * or ?: The sorted=($(…)) part is using the “split and glob” operator. You should … Read more

zip error – Nothing to do

The issue is that you have not provided a name for the zip-files it will create. This will create separate zipped directories for each of the subfolders tmp tmp_dkjg and tmp_dsf

What’s the meaning of the parameter -e for bash shell command line?

The -e option means “if any pipeline ever ends with a non-zero (‘error’) exit status, terminate the script immediately”. Since grep returns an exit status of 1 when it doesn’t find any match, it can cause -e to terminate the script even when there wasn’t a real “error”. If you want to keep the -e option, but also have a grep command that might validly find no … Read more

Variable interpolation in the shell

Use or or _ is a valid character in identifiers. Dot is not, so the shell tried to interpolate $filepath_newstap. You can use set -u to make the shell exit with an error when you reference an undefined variable.

Using SED with wildcard

The asterisk (*) means “zero or more of the previous item”. If you want to match any single character use If you want to match any string (i.e. any single character zero or more times) use

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