Bash-4.3 distribution sources and documentation
[platform/upstream/bash.git] / examples / functions / substr2
index 2bb8d36..fc21b98 100644 (file)
@@ -1,4 +1,22 @@
 #
+#  Chet Ramey <chet.ramey@case.edu>
+#
+#  Copyright 2002 Chester Ramey
+#
+#   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 2, or (at your option)
+#   any later version.
+#
+#   TThis 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, write to the Free Software Foundation,
+#   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
 # substr -- a function to emulate the ancient ksh builtin
 #
 
@@ -29,7 +47,7 @@ substr()
        done
 
        if [ "$OPTIND" -gt 1 ] ; then
-               shift $[ $OPTIND -1 ]
+               shift $(( $OPTIND -1 ))
        fi
 
        if [ "$#" -eq 0 ] || [ "$#" -gt 2 ] ; then