What are shell form and exec form?

The docker shell syntax (which is just a string as the RUN, ENTRYPOINT, and CMD) will run that string as the parameter to /bin/sh -c. This gives you a shell to expand variables, sub commands, piping output, chaining commands together, and other shell conveniences. RUN ls * | grep $trigger_filename || echo file missing && … Read more

sh read command eats backslashes in input?

Accrding to: http://www.vias.org/linux-knowhow/bbg_sect_08_02_01.html : -r If this option is given, backslash does not act as an escape character. The backslash is considered to be part of the line. In particular, a backslash-newline pair may not be used as a line continuation. It works on my machine. $ echo ‘\&|’ | while read -r in; do … Read more

Batch convert latin-1 files to utf-8 using iconv

You shouldn’t use ls like that and a for loop is not appropriate either. Also, the destination directory should be outside the source directory. mkdir /path/to/destination find . -type f -exec iconv -f iso-8859-1 -t utf-8 “{}” -o /path/to/destination/”{}” \; No need for a loop. The -type f option includes files and excludes directories. Edit: … Read more

nginx: use environment variables

With NGINX Docker image Apply envsubst on template of the configuration file at container start. envsubst is included in official NGINX docker images. Environment variable is referenced in a form $VARIABLE or ${VARIABLE}. nginx.conf.template: user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { server { listen 80; location … Read more

Remove part of path on Unix

If you wanted to remove a certain NUMBER of path components, you should use cut with -d”https://stackoverflow.com/”. For example, if path=/home/dude/some/deepish/dir: To remove the first two components: # (Add 2 to the number of components to remove to get the value to pass to -f) echo $path | cut -d”https://stackoverflow.com/” -f4- # output: # some/deepish/dir … Read more

how do I use the grep –include option for multiple file types?

You can use multiple –include flags. This works for me: grep -r –include=*.html –include=*.php –include=*.htm “pattern” /some/path/ However, you can do as Deruijter suggested. This works for me: grep -r –include=*.{html,php,htm} “pattern” /some/path/ Don’t forget that you can use find and xargs for this sort of thing too: find /some/path/ -name “*.htm*” -or -name “*.php” … Read more

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