[lug] bash scripting question

Hugh Brown hugh at math.byu.edu
Fri Nov 18 12:12:07 MST 2005


It looks like I spoke prematurely on a different email.

 for i in *;do command "$i"; done

is now working (probably because I had a horked IFS from my own testing).

The below script/method also works for me.

Thanks to all.

Hugh



>
> Create some files:
>
> $ echo "file" > file
> $ echo "first_file_with_space" > first\ space
> $ echo "second_file_with_space" > second\ space
>
> So we have this ls output:
>
> $ ls -1
> file
> first space
> second space
>
> Perform steps to echo the file name, and the number of characters
> contained in each file:
>
> $ ls | while read line
> > do
> > echo -e "$line\t\c"
> > cat "$line" | wc -c
> > done
> file    5
> first space     22
> second space    23
>
>
> Will this accomplish your task?
>
> --
>
> D. Frye
> dafr AT dafr.us
> dafr AT peakpeak.com
> http://www.dafr.us/dafr
>
>
>



More information about the LUG mailing list