#!/bin/bash jpegs="" jpegs="$(swfextract $1 |grep 'JPEG'|awk -F')' '{print $NF}')" echo "$jpegs" #要将$a分割开,可以这样: OLD_IFS="$IFS" IFS="," arr=($jpegs) IFS="$OLD_IFS" for s in ${arr[@]} do swfextract $1 -j $s -o $2/$s.jpg done pngs="" pngs="$(swfextract $1 |grep 'PNG'|awk -F')' '{print $NF}')" echo "$pngs" OLD_IFS="$IFS" IFS="," arr=($pngs) for s in ${arr[@]} do swfextract $1 -p $s -o $2/$s.png done echo "ok"