2016-06-27 19:00:19 +00:00
|
|
|
#!/bin/bash
|
2016-03-22 19:09:18 +00:00
|
|
|
|
|
|
|
# Copyright (C) 2016
|
|
|
|
# Ole Tange and Free Software Foundation, Inc.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, see <http://www.gnu.org/licenses/>
|
|
|
|
# or write to the Free Software Foundation, Inc., 51 Franklin St,
|
|
|
|
# Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
2016-06-27 19:00:19 +00:00
|
|
|
while test $# -gt 0; do
|
|
|
|
key="$1"
|
|
|
|
|
|
|
|
case $key in
|
|
|
|
-i|--install)
|
|
|
|
grep env_parallel.bash $HOME/.bashrc 2>/dev/null ||
|
|
|
|
echo '. `which env_parallel.bash`' >> $HOME/.bashrc
|
|
|
|
grep env_parallel.zsh $HOME/.zshenv 2>/dev/null ||
|
|
|
|
echo '. `which env_parallel.zsh`' >> $HOME/.zshenv
|
|
|
|
mkdir -p $HOME/.config/fish
|
|
|
|
grep env_parallel.fish $HOME/.config/fish/config.fish 2>/dev/null ||
|
|
|
|
echo '. (which env_parallel.fish)' >> $HOME/.config/fish/config.fish
|
|
|
|
grep env_parallel.ksh $HOME/.kshrc 2>/dev/null ||
|
|
|
|
echo 'source `which env_parallel.ksh`' >> $HOME/.kshrc
|
|
|
|
grep env_parallel.pdksh $HOME/.profile 2>/dev/null ||
|
|
|
|
echo 'source `which env_parallel.pdksh`' >> $HOME/.profile
|
|
|
|
grep env_parallel.csh $HOME/.cshrc 2>/dev/null ||
|
|
|
|
echo 'source `which env_parallel.csh`' >> $HOME/.cshrc
|
|
|
|
grep env_parallel.tcsh $HOME/.tcshrc 2>/dev/null ||
|
|
|
|
echo 'source `which env_parallel.tcsh`' >> $HOME/.tcshrc
|
|
|
|
echo 'Installed env_parallel in: '
|
|
|
|
echo " " $HOME/.bashrc
|
|
|
|
echo " " $HOME/.zshenv
|
|
|
|
echo " " $HOME/.config/fish/config.fish
|
|
|
|
echo " " $HOME/.kshrc
|
|
|
|
echo " " $HOME/.profile
|
|
|
|
echo " " $HOME/.cshrc
|
|
|
|
echo " " $HOME/.tcshrc
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown option: $key"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift # past argument or value
|
|
|
|
done
|
|
|
|
|
2016-03-22 19:09:18 +00:00
|
|
|
|
|
|
|
cat <<_EOS
|
|
|
|
env_parallel only works if it is a function. Do the below and restart your shell.
|
|
|
|
|
|
|
|
bash: Put this in $HOME/.bashrc: . `which env_parallel.bash`
|
|
|
|
E.g. by doing: echo '. `which env_parallel.bash`' >> $HOME/.bashrc
|
|
|
|
Supports: aliases, functions, variables, arrays
|
|
|
|
|
|
|
|
zsh: Put this in $HOME/.zshrc: . `which env_parallel.zsh`
|
2016-03-26 09:35:13 +00:00
|
|
|
E.g. by doing: echo '. `which env_parallel.zsh`' >> $HOME/.zshenv
|
2016-03-22 19:09:18 +00:00
|
|
|
Supports: functions, variables, arrays
|
|
|
|
|
|
|
|
fish: Put this in $HOME/.config/fish/config.fish:
|
2016-06-27 19:00:19 +00:00
|
|
|
. (which env_parallel.fish)
|
2016-03-22 19:09:18 +00:00
|
|
|
E.g. by doing:
|
2016-06-27 19:00:19 +00:00
|
|
|
echo '. (which env_parallel.fish)' >> $HOME/.config/fish/config.fish
|
2016-03-26 09:35:13 +00:00
|
|
|
Supports: aliases, functions, variables, arrays
|
2016-03-22 19:09:18 +00:00
|
|
|
|
|
|
|
ksh: Put this in $HOME/.kshrc: source `which env_parallel.ksh`
|
|
|
|
E.g. by doing: echo 'source `which env_parallel.ksh`' >> $HOME/.kshrc
|
|
|
|
Supports: aliases, functions, variables, arrays
|
|
|
|
|
|
|
|
pdksh: Put this in $HOME/.profile: source `which env_parallel.pdksh`
|
|
|
|
E.g. by doing: echo 'source `which env_parallel.pdksh`' >> $HOME/.profile
|
|
|
|
Supports: aliases, functions, variables, arrays
|
|
|
|
|
2016-03-26 09:35:13 +00:00
|
|
|
csh: Put this in $HOME/.cshrc: source `which env_parallel.csh`
|
|
|
|
E.g. by doing: echo 'source `which env_parallel.csh`' >> $HOME/.cshrc
|
2016-04-14 06:33:58 +00:00
|
|
|
Supports: aliases, variables, arrays with no special chars
|
|
|
|
|
|
|
|
tcsh: Put this in $HOME/.tcshrc: source `which env_parallel.tcsh`
|
|
|
|
E.g. by doing: echo 'source `which env_parallel.tcsh`' >> $HOME/.tcshrc
|
|
|
|
Supports: aliases, variables, arrays with no special chars
|
2016-03-26 09:35:13 +00:00
|
|
|
|
2016-06-27 19:00:19 +00:00
|
|
|
To install in all shells run:
|
|
|
|
|
|
|
|
env_parallel --install
|
|
|
|
|
2016-03-22 19:09:18 +00:00
|
|
|
For details: see man env_parallel
|
|
|
|
|
|
|
|
_EOS
|