#!/bin/bash filenames=$( ls *.tar.xz ) for filename in ${filenames[@]}; do echo "Decompressing ${filename}" tar -xJf "${filename}" done