Teches

Copy With Cp to Include Hidden Files

“How can I make cp -r copy absolutely all of the files and directories in a directory\r\n\r\nRequirements:\r\n\r\n - Include hidden files and hidden directories.\r\n - Be one single command with an flag to include the above.\r\n - Not need to rely on pattern matching at all.\r\n\r\nMy ugly, but working, hack is:\r\n\r\n cp -r /etc/skel/* /home/user\r\n cp -r /etc/skel/.[^.]* /home/user\r\n\r\nHow can I do this all in one command without the pattern matching?

Ansible Include vs Import

“In Ansible 2.4, the include module is deprecated. In its place, it ships with two replacement modules, import_tasks and include_tasks. But they have very similar descriptions:\r\n\r\n- include_tasks: Includes a file with a list of tasks to be executed in the current playbook.\r\n- import_tasks: Imports a list of tasks to be added to the current playbook for subsequent execution.\r\n\r\nWhen should I use the former, and when should I use the latter?” <a href=““https://serverfault.

Custom Lxc Template

“(Please note that this question is about LXC 1.x, whereas this one is about LXC 2.x/LXD)\r\n\r\nI scoured the web for an answer to this one, but couldn't come up with any reasonably non-hacky answer.\r\n\r\nWhat I am looking for is an approach to fashion an existing template a way I'd like to. In particular what I'm after is to customize the upstream Ubuntu cloud image by making various changes in its root FS and adding/changing configuration.

Venv Pyvenv Pyenv Virtualenv Difference

“Python 3.3 includes in its standard library the new package venv. What does it do, and how does it differ from all the other packages that match the regex (py)?(v|virtual|pip)?env?” <a href=““https://stackoverflow.com/questions/41573587/what-is-the-difference-between-venv-pyvenv-pyenv-virtualenv-virtualenvwrappe"">— “Flimm”

Add Certificates to Kubeconf

“I have an local Kubernetes environment and I basically copy .kube/config file to my local and added "context", "users", and "cluster" informations to my current ".kube/config" file. That's ok, I can connect to my local file.\r\n\r\nBut I want to add these informations to my local config file with commands.\r\n\r\nSo regarding to this page, I can use "certificate-authority-data" as parameter like below: —> https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/\r\n\r\n PS C:\Users\user\.kube> kubectl config –kubeconfig=config set-cluster local-kubernetes –server=https://10.

Run Commands From Host on Container

“We would like to harden our Docker Image and remove redundant software from it. Our Devs and Ops asked to keep some Linux tools used for debugging on the containers running on our Kubernetes Prod environment. \r\n\r\nI’ve read this post:\r\n<https://www.digitalocean.com/community/tutorials/how-to-inspect-kubernetes-networking>\r\n\r\nAnd it made me wonder, is it possible to run commands that exist only on the host, on a container (which those commands have been removed from)?\r\n\r\nIf so is there a difference between commands that have been removed from the container than ones that the user don’t have permissions to run?

Why 0 Is Not a Positional Parameter

“I have read that positional parameters start at $1 (for example: $1, $2, $3 and so on are positional parameters). But $0 is not a positional parameter.\r\n\r\nBut why $0 is not a positional parameter?\r\n\r\nI think this could be a reason, but not sure:\r\n\r\nPositional parameters only take their values when a script is executed. For example: if we do ./myScript Hello, then $1 will have the value Hello. But $0 can take its value on two occasions: when a script is executed (it would have the value of the script name), and when bash itself is executed without a script (it would have the value bash or -bash).

Pipe Input Into Interactive Process

“I'd like to be able to inject an initial command into the launching of an interactive process, so that I can do something like this: echo &quot;initial command&quot; | INSERT_MAGIC_HERE some_tool tool&gt; initial command [result of initial command] tool&gt; [now I type an interactive command] What doesn't work: Just piping the initial command in doesn't work, as this results in stdin not being connected to the terminal Writing to /dev/pts/[number] sends the output to the terminal, not input to the process as if it were from the terminal

Bash Multiple Variable Assignment

“Does exist in linux bash something similar to the following code in PHP:\r\n\r\n list($var1, $var2, $var3) = function_that_returns_a_three_element_array() ;\r\n\r\ni.e. you assign in one sentence a corresponding value to 3 different variables.\r\n\r\nLet's say I have the bash function myBashFuntion that writes to stdout the string "qwert asdfg zxcvb".\r\nIs it possible to do something like:\r\n\r\n (var1 var2 var3) = ( myBashFuntion param1 param2 )\r\n\r\nThe part at the left of the equal sign is not valid syntax of course.

Read Values Into a Shell Variable From a Pipe

“I am trying to get bash to process data from stdin that gets piped into, but no luck. What I mean is none of the following work:\r\n\r\n echo "hello world" | test=($(< /dev/stdin)); echo test=$test\r\n test=\r\n\r\n echo "hello world" | read test; echo test=$test\r\n test=\r\n\r\n echo "hello world" | test=cat; echo test=$test\r\n test=\r\n\r\nwhere I want the output to be test=hello world. I've tried putting "" quotes around &quot;$test&quot; that doesn't work either.