Skip to content

Commit

Permalink
Rewrite jot/seq loop in env.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Feb 21, 2016
1 parent 01a7a3f commit a97e7ec
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ if [ -z "$*" ]; then
echo "==> Back to system shell..."
echo
else
if [ $# -gt 1 ]; then
s='$'
if [ "$#" -gt 1 ]; then
par=""
if command -v seq >/dev/null; then
for p in `seq 1 $(($#-1))`; do par=$par"\$$p "; done
elif
command -v jot >/dev/null; then
for p in `jot $(($#-1)) 1`; do par=$par"\$$p "; done
fi
p=0
while : ; do
p=$(($p+1))
[ $p -gt $# ] && break
a=`eval echo "$s$p"`
par="$par$a "
done
eval $new_env $par "\"\$$#\""
else
eval $new_env $*
Expand Down

0 comments on commit a97e7ec

Please sign in to comment.