# Output to standard out AND a file at the same time

September 30, 2013

Let’s say you’re running a script, and you want the output to show up in the terminal and be output to a file simultaneously. This is how to do that:

<your-command-here> | tee <output-file>

Example:

./myscript.sh | tee out.txt

# Automation: For loops in bash (for loops on the command line)

September 23, 2013

If you have to run a script that processes data for a particular file for a particular day, i.e. your file is on hadoop with the date in the path, like this:

/path/to/my/data/2013/09/23/*

And you have multiple days to process, don’t run them manually. Use a for loop instead:

for day in {19..22}
do
  ./my_script.sh 2013/09/\$day
done
#command line