#!/bin/bash
SEP="/"
var=0

while IFS=' ' read -a line; 
do
    # There are maximum 4 $line 
	if [ $line[0] ]; then
		tmp="$(echo -e "${line[0]}" | tr -d '[[:space:]]')"
		startLine0=$(echo ${tmp:0:1})
		#startLine0=$(echo ${line[0]:0:1})
		#echo "$startLine0"
	fi 
	if [ $line[1] ]; then
		tmp="$(echo -e "${line[1]}" | tr -d '[[:space:]]')"
		startLine1=$(echo ${tmp:0:1})
		#startLine1=$(echo ${line[1]:0:1})
		#echo "$startLine1"
	fi
	if [ $line[2] ]; then
		tmp="$(echo -e "${line[2]}" | tr -d '[[:space:]]')"
		startLine2=$(echo ${tmp:0:1})
		#startLine2=$(echo ${line[2]:0:1})
		#echo "$startLine2"
	fi
	if [ $line[3] ]; then
		tmp="$(echo -e "${line[3]}" | tr -d '[[:space:]]')"
		startLine3=$(echo ${tmp:0:1})
		#startLine3=$(echo ${line[3]:0:1})
		#echo "$startLine3"
	fi

	######################################
	if [ "$startLine0" = "$SEP" ]; then
		var=$((var+1))
		echo "0 $var - ${line[0]}"	
		sh -v -c "cp ${line[0]} ."
		echo $?
	fi   

	if [ "$startLine1" = "$SEP" ]; then
		var=$((var+1))
		echo "1 $var - ${line[1]}"	
		sh -v -c "cp ${line[1]} ."
		echo $?
	fi   

	if [ "$startLine2" = "$SEP" ]; then
		var=$((var+1))
		echo "2 $var - ${line[2]}"	
		sh -v -c "cp ${line[2]} ."
		echo $?
	fi   

	if [ "$startLine3" = "$SEP" ]; then
		var=$((var+1))
		echo "3 $var - ${line[3]}"
		sh -v -c "cp ${line[3]} ."
		echo $?
	fi   
       
done < "$1"

