Using find command in bash script

Welcome to bash. It’s an old, dark and mysterious thing, capable of great magic. 🙂 The option you’re asking about is for the find command though, not for bash. From your command line, you can man find to see the options. The one you’re looking for is -o for “or”: list=”$(find /home/user/Desktop -name ‘*.bmp’ -o … Read more

Pass private key password to openvpn command directly in Ubuntu 10.10 [closed]

In my openvpn.conf: … askpass /etc/openvpn/jdoe.pass <<< new line here ca /etc/openvpn/jdoe_ca.crt cert /etc/openvpn/jdoe.crt key /etc/openvpn/jdoe.key … The file /etc/openvpn/jdoe.pass just contains the password. You can chmod this file to 600. This method save my life… 😉 Ubuntu 12.04.4 LTS OpenVPN 2.2.1 x86_64-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built … Read more

Writing a custom management command with args and options – explanation of fields needed

Explanation of make_option from the docs http://docs.python.org/2/library/optparse.html#populating-the-parser make_option() is a factory function for creating Option instances; currently it is an alias for the Option constructor. A future version of optparse may split Option into several classes, and make_option() will pick the right class to instantiate. Do not instantiate Option directly. These are all of the … Read more

link several Popen commands with pipes

I think you want to instantiate two separate Popen objects here, one for ‘ls’ and the other for ‘sed’. You’ll want to pass the first Popen object’s stdout attribute as the stdin argument to the 2nd Popen object. Example: p1 = subprocess.Popen(‘ls …’, stdout=subprocess.PIPE) p2 = subprocess.Popen(‘sed …’, stdin=p1.stdout, stdout=subprocess.PIPE) print p2.communicate() You can keep … Read more

Running shell script using .env file

You need to source the environment in the calling shell before starting the script: source ‘filename.env’ && bash ‘scriptname.sh’ In order to prevent polution of the environment of the calling shell you might run that in a sub shell: (source ‘filename.env’ && bash ‘scriptname.sh’)

File not found.