Hi
I am running a shell script with bdf command and want to match all files with length 3 inside a specific partitions. How do i do that
say
for example if i want to list all files with length 3 in /home/jimmy partition,
bdf /home/jimmy
the output i need is
xyx
abc
yyy
amp
Thanks
s93366
2
#!/bin/bash
for i in `ls $1`
do
if [ `echo -n $i|wc --char` -eq 3 ]
then
echo $i
fi
done
pludi
3
bdf won't give you any info on the files inside that partition. Instead try
find /home/jimmy -name '???' -type -f -print
cd /home/jimmy
printf "%s\n" ???
Not only is ls unnecessary, but it will break the script if any filenames contain spaces.