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

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.

Implementation of multiple pipes in C

I believe the issue here is that your waiting and closing inside the same loop that’s creating children. On the first iteration, the child will exec (which will destroy the child program, overwriting it with your first command) and then the parent closes all of its file descriptors and waits for the child to finish … Read more

Multi-dimensional arrays in Bash

Bash does not support multidimensional arrays, nor hashes, and it seems that you want a hash that values are arrays. This solution is not very beautiful, a solution with an xml file should be better : EDIT: this answer is quite old, since since bash 4 supports hash tables, see also this answer for a solution without … Read more

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