Skip to content

Instantly share code, notes, and snippets.

@joepol
Last active August 9, 2020 15:26
Show Gist options
  • Save joepol/3e0fc14fea3e2a1b6c5f00db1d3038f7 to your computer and use it in GitHub Desktop.
Save joepol/3e0fc14fea3e2a1b6c5f00db1d3038f7 to your computer and use it in GitHub Desktop.
Bash script to run all files in a directory redirect output to text file
#!/bin/bash
echo "Run all files in dir, redirect outputs to text files"
echo " "
for file in DIRECTORY/*
do
filename=`basename $file`
echo "Currently runing $filename"
"$file" >> output_$filename.txt
done
@joepol
Copy link
Author

joepol commented Aug 9, 2020

musn't be same of the script (recursion...)
Replace it with your full path directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment