5

How do I test the first char of each line in an array

view full story
linux-howto

http://www.unix.com – Hi folks, I am self-learning as I can I have a script that has read a file into an array. I can read out each line in the array with the code: Code: for INDEX in {0..$LENGTH}  ## $LENGTH was determined at the read in do   echo "${data[$INDEX]}" done What I need to do is test the first char of each line so I can branch out for processing. In essence, the psudo-code looks like this: Code: for INDEX in {0..$LENGTH}  ## $LENGTH was determined at the read in do   If the first char of "${data[$INDEX]}" = " " then skip   or   (HowTos)