Dockerfile: how to set env variable from file contents

Environment Variables If you want to set a number of environment variables into your docker image (to be used within the containers) you can simply use env_file configuration option in your docker-compose.yml file. With that option, all the entries in the .env file will be set as the environment variables in image and hence into … Read more

${1:+”$@”} in /bin/sh

‘Hysterical Raisins’, aka Historical Reasons. The explanation from JesperE (or the Bash man page on shell parameter expansion) is accurate for what it does: If $1 exists and is not an empty string, then substitute the quoted list of arguments. Once upon 20 or so years ago, some broken minor variants of the Bourne Shell … Read more

How to check if a file is binary?

Use utility file, sample usage: $ file /bin/bash /bin/bash: Mach-O universal binary with 2 architectures /bin/bash (for architecture x86_64): Mach-O 64-bit executable x86_64 /bin/bash (for architecture i386): Mach-O executable i386 $ file /etc/passwd /etc/passwd: ASCII English text $ file code.c code.c: ASCII c program text file manual page

Is it possible to get the compressed and uncompressed sizes of a file on a btrfs file system?

there is a third party tool that can do this. https://github.com/kilobyte/compsize usage: ayush@devbox:/code/compsize$ sudo compsize /opt Processed 54036 files, 42027 regular extents (42028 refs), 27150 inline. Type Perc Disk Usage Uncompressed Referenced Data 82% 5.3G 6.4G 6.4G none 100% 4.3G 4.3G 4.3G zlib 37% 427M 1.1G 1.1G lzo 56% 588M 1.0G 1.0G

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