Skip to content

Instantly share code, notes, and snippets.

@rafaelhdr
Created July 4, 2017 14:38
Show Gist options
  • Save rafaelhdr/b1f270b3ccee74bfa086c6b266c1ef16 to your computer and use it in GitHub Desktop.
Save rafaelhdr/b1f270b3ccee74bfa086c6b266c1ef16 to your computer and use it in GitHub Desktop.
Shell long write to file
#!/bin/sh
#
# Command examples:
# time ./write.sh
# time ./write.sh 1000
#
# This will print time taken (default test, max=100000)
# real 0m1.258s
# user 0m0.816s
# sys 0m0.438s
if [ -z "$1" ]; then
max=100000
else
max="$1"
fi
echo "" > myfile.txt
for i in `seq 2 $max`
do
echo "$i" >> myfile.txt
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment