hadoop@Mcnode4:~/cloud/adam/xubo/data/test20160310/bwa3sh/test142234$ cat showFileAndDirectory.sh
#!/bin/bash
dir=$(ls -l ./ |awk '!/^d/ {print $NF}')
for i in $dir
do
echo "File:"$i
done
dir=$(ls -l ./ |awk '/^d/ {print $NF}')
for i in $dir
do
echo "Directory:"$i
done
结果:
hadoop@Mcnode4:~/cloud/adam/xubo/data/test20160310/bwa3sh/test142234$ ./showFileAndDirectory.sh
File:4917568
File:a.sh
File:sam2bam.sh
File:showDirectory.sh
File:showFileAndDirectory.sh
File:SRR003161h100000t1.sai
File:SRR003161h100000t1.sam
File:SRR003161h100000t2.sai
File:SRR003161h100000t2.sam
File:SRR003161h100000t3.sai
File:SRR003161h100000t3.sam
File:SRR003161h10000t1.sai
File:SRR003161h10000t1.sam
File:SRR003161h10000t2.sai
File:SRR003161h10000t2.sam
File:SRR003161h10000t3.sai
File:SRR003161h10000t3.sam
File:SRR003161h1000t1.sai
File:SRR003161h1000t2.sai
File:SRR003161h1000t2.sam
File:SRR003161h1000t3.sai
File:SRR003161h1000t3.sam
File:SRR003161h20t1.bam
File:SRR003161h20t1.sai
File:SRR003161h20t1.sam
File:SRR003161h20t1Sort.bam
File:SRR003161h20t1.sorted.bam
File:SRR003161h20t2.sai
File:SRR003161h20t2.sam
File:SRR003161h20t3.sai
File:SRR003161h20t3.sam
File:SRR003161t1.bam
File:SRR003161t1.sai
File:SRR003161t1.sam
File:SRR003161t2.sai
File:SRR003161t2.sam
File:SRR003161t3.sai
File:SRR003161t3.sam
File:te.sh
Directory:fff