Skip to content

Instantly share code, notes, and snippets.

@tuffacton
Last active June 26, 2018 23:48
Show Gist options
  • Select an option

  • Save tuffacton/2bd36edb47c92bfec33cef2c51550ab9 to your computer and use it in GitHub Desktop.

Select an option

Save tuffacton/2bd36edb47c92bfec33cef2c51550ab9 to your computer and use it in GitHub Desktop.
Bash scripting and examples

One liner conda install example:

$ for i in $(ls <directory>); do conda install <directory>/$i; done

Saved shell script example (if named shell.sh then you can use sh shell.sh to activate):

#!/bin/bash
for file in /etc/*
do
	if [ "${file}" == "/etc/resolv.conf" ]
	then
		countNameservers=$(grep -c nameserver /etc/resolv.conf)
		echo "Total  ${countNameservers} nameservers defined in ${file}"
		break
	fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment