Bash String Functions Substring Method Javascript Array