Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save beltiras/3beb2e18e253b1db7c76215cc8fb5c72 to your computer and use it in GitHub Desktop.
Save beltiras/3beb2e18e253b1db7c76215cc8fb5c72 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ "$#" -eq 0 ]
then
ls | sort | run-parts ${BASH_SOURCE[0]}
fi
if [ $1 ! 1 ]
then
echo "Invalid number of arguments"
exit
fi
if [ ! -d $1 ]
then
echo "directory does not exist"
exit
fi
cd $1
ls $1 | sort | xargs run-parts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment