env_parallel.bash: Allow for $array[1]-variables to be used for parset.

env_parallel: Install in .shrc.
This commit is contained in:
Ole Tange 2017-11-22 21:48:00 +01:00
parent 823645285f
commit 04cca9fe43
2 changed files with 5 additions and 2 deletions

View file

@ -40,6 +40,7 @@ while test $# -gt 0; do
case $key in
-i|--install)
installer . env_parallel.bash $HOME/.bashrc
installer . env_parallel.sh $HOME/.shrc
installer . env_parallel.zsh $HOME/.zshenv
installer source env_parallel.ksh $HOME/.kshrc
echo $SHELL | grepq /pdksh &&
@ -55,6 +56,7 @@ while test $# -gt 0; do
echo '. (which env_parallel.fish)' >> $HOME/.config/fish/config.fish
echo 'Installed env_parallel in: '
echo " " $HOME/.bashrc
echo " " $HOME/.shrc
echo " " $HOME/.zshenv
echo " " $HOME/.config/fish/config.fish
echo " " $HOME/.kshrc

View file

@ -206,12 +206,13 @@ parset() {
if [ "$_parset_name" == "" ] ; then
echo parset: Error: No destination variable given. >&2
echo parset: Error: Try: >&2
echo parset: Error: ' ' parset myvar echo ::: foo >&2
echo parset: Error: ' ' parset myarray echo ::: foo bar >&2
return 255
fi
echo "$_parset_name" |
perl -ne 'chomp;for (split /[, ]/) {
if(not /^[a-zA-Z_][a-zA-Z_0-9]*$/) {
# Allow: var_32 var[3]
if(not /^[a-zA-Z_][a-zA-Z_0-9]*(\[\d+\])?$/) {
print STDERR "parset: Error: $_ is an invalid variable name.\n";
print STDERR "parset: Error: Variable names must be letter followed by letters or digits.\n";
$exitval = 255;