Created
July 4, 2017 14:38
-
-
Save rafaelhdr/b1f270b3ccee74bfa086c6b266c1ef16 to your computer and use it in GitHub Desktop.
Shell long write to file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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